home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpconnect / nsIXPConnect.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  78KB  |  1,531 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIXPConnect.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIXPConnect_h__
  6. #define __gen_nsIXPConnect_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. #ifndef __gen_nsIClassInfo_h__
  14. #include "nsIClassInfo.h"
  15. #endif
  16.  
  17. #ifndef __gen_xpccomponents_h__
  18. #include "xpccomponents.h"
  19. #endif
  20.  
  21. #ifndef __gen_xpcjsid_h__
  22. #include "xpcjsid.h"
  23. #endif
  24.  
  25. #ifndef __gen_xpcexception_h__
  26. #include "xpcexception.h"
  27. #endif
  28.  
  29. #ifndef __gen_nsIInterfaceInfo_h__
  30. #include "nsIInterfaceInfo.h"
  31. #endif
  32.  
  33. #ifndef __gen_nsIInterfaceInfoManager_h__
  34. #include "nsIInterfaceInfoManager.h"
  35. #endif
  36.  
  37. #ifndef __gen_nsIExceptionService_h__
  38. #include "nsIExceptionService.h"
  39. #endif
  40.  
  41. #ifndef __gen_nsIVariant_h__
  42. #include "nsIVariant.h"
  43. #endif
  44.  
  45. /* For IDL files that don't want to include root IDL files. */
  46. #ifndef NS_NO_VTABLE
  47. #define NS_NO_VTABLE
  48. #endif
  49. #include "jspubtd.h"
  50. #include "xptinfo.h"
  51. /***************************************************************************/
  52. #define GENERATE_XPC_FAILURE(x) \
  53.             (NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCONNECT,x))
  54. #define NS_ERROR_XPC_NOT_ENOUGH_ARGS                   GENERATE_XPC_FAILURE( 1)
  55. #define NS_ERROR_XPC_NEED_OUT_OBJECT                   GENERATE_XPC_FAILURE( 2)
  56. #define NS_ERROR_XPC_CANT_SET_OUT_VAL                  GENERATE_XPC_FAILURE( 3)
  57. #define NS_ERROR_XPC_NATIVE_RETURNED_FAILURE           GENERATE_XPC_FAILURE( 4)
  58. #define NS_ERROR_XPC_CANT_GET_INTERFACE_INFO           GENERATE_XPC_FAILURE( 5)
  59. #define NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO         GENERATE_XPC_FAILURE( 6)
  60. #define NS_ERROR_XPC_CANT_GET_METHOD_INFO              GENERATE_XPC_FAILURE( 7)
  61. #define NS_ERROR_XPC_UNEXPECTED                        GENERATE_XPC_FAILURE( 8)
  62. #define NS_ERROR_XPC_BAD_CONVERT_JS                    GENERATE_XPC_FAILURE( 9)
  63. #define NS_ERROR_XPC_BAD_CONVERT_NATIVE                GENERATE_XPC_FAILURE(10)
  64. #define NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF           GENERATE_XPC_FAILURE(11)
  65. #define NS_ERROR_XPC_BAD_OP_ON_WN_PROTO                GENERATE_XPC_FAILURE(12)
  66. #define NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN            GENERATE_XPC_FAILURE(13)
  67. #define NS_ERROR_XPC_CANT_DEFINE_PROP_ON_WN            GENERATE_XPC_FAILURE(14)
  68. #define NS_ERROR_XPC_CANT_WATCH_WN_STATIC              GENERATE_XPC_FAILURE(15)
  69. #define NS_ERROR_XPC_CANT_EXPORT_WN_STATIC             GENERATE_XPC_FAILURE(16)
  70. #define NS_ERROR_XPC_SCRIPTABLE_CALL_FAILED            GENERATE_XPC_FAILURE(17)
  71. #define NS_ERROR_XPC_SCRIPTABLE_CTOR_FAILED            GENERATE_XPC_FAILURE(18)
  72. #define NS_ERROR_XPC_CANT_CALL_WO_SCRIPTABLE           GENERATE_XPC_FAILURE(19)
  73. #define NS_ERROR_XPC_CANT_CTOR_WO_SCRIPTABLE           GENERATE_XPC_FAILURE(20)
  74. #define NS_ERROR_XPC_CI_RETURNED_FAILURE               GENERATE_XPC_FAILURE(21)
  75. #define NS_ERROR_XPC_GS_RETURNED_FAILURE               GENERATE_XPC_FAILURE(22)
  76. #define NS_ERROR_XPC_BAD_CID                           GENERATE_XPC_FAILURE(23)
  77. #define NS_ERROR_XPC_BAD_IID                           GENERATE_XPC_FAILURE(24)
  78. #define NS_ERROR_XPC_CANT_CREATE_WN                    GENERATE_XPC_FAILURE(25)
  79. #define NS_ERROR_XPC_JS_THREW_EXCEPTION                GENERATE_XPC_FAILURE(26)
  80. #define NS_ERROR_XPC_JS_THREW_NATIVE_OBJECT            GENERATE_XPC_FAILURE(27)
  81. #define NS_ERROR_XPC_JS_THREW_JS_OBJECT                GENERATE_XPC_FAILURE(28)
  82. #define NS_ERROR_XPC_JS_THREW_NULL                     GENERATE_XPC_FAILURE(29)
  83. #define NS_ERROR_XPC_JS_THREW_STRING                   GENERATE_XPC_FAILURE(30)
  84. #define NS_ERROR_XPC_JS_THREW_NUMBER                   GENERATE_XPC_FAILURE(31)
  85. #define NS_ERROR_XPC_JAVASCRIPT_ERROR                  GENERATE_XPC_FAILURE(32)
  86. #define NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS     GENERATE_XPC_FAILURE(33)
  87. #define NS_ERROR_XPC_CANT_CONVERT_PRIMITIVE_TO_ARRAY   GENERATE_XPC_FAILURE(34)
  88. #define NS_ERROR_XPC_CANT_CONVERT_OBJECT_TO_ARRAY      GENERATE_XPC_FAILURE(35)
  89. #define NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY      GENERATE_XPC_FAILURE(36)
  90. #define NS_ERROR_XPC_CANT_GET_ARRAY_INFO               GENERATE_XPC_FAILURE(37)
  91. #define NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING        GENERATE_XPC_FAILURE(38)
  92. #define NS_ERROR_XPC_SECURITY_MANAGER_VETO             GENERATE_XPC_FAILURE(39)
  93. #define NS_ERROR_XPC_INTERFACE_NOT_SCRIPTABLE          GENERATE_XPC_FAILURE(40)
  94. #define NS_ERROR_XPC_INTERFACE_NOT_FROM_NSISUPPORTS    GENERATE_XPC_FAILURE(41)
  95. #define NS_ERROR_XPC_CANT_GET_JSOBJECT_OF_DOM_OBJECT   GENERATE_XPC_FAILURE(42)
  96. #define NS_ERROR_XPC_CANT_SET_READ_ONLY_CONSTANT       GENERATE_XPC_FAILURE(43)
  97. #define NS_ERROR_XPC_CANT_SET_READ_ONLY_ATTRIBUTE      GENERATE_XPC_FAILURE(44)
  98. #define NS_ERROR_XPC_CANT_SET_READ_ONLY_METHOD         GENERATE_XPC_FAILURE(45)
  99. #define NS_ERROR_XPC_CANT_ADD_PROP_TO_WRAPPED_NATIVE   GENERATE_XPC_FAILURE(46)
  100. #define NS_ERROR_XPC_CALL_TO_SCRIPTABLE_FAILED         GENERATE_XPC_FAILURE(47)
  101. #define NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED    GENERATE_XPC_FAILURE(48)
  102. #define NS_ERROR_XPC_BAD_ID_STRING                     GENERATE_XPC_FAILURE(49)
  103. #define NS_ERROR_XPC_BAD_INITIALIZER_NAME              GENERATE_XPC_FAILURE(50)
  104. #define NS_ERROR_XPC_HAS_BEEN_SHUTDOWN                 GENERATE_XPC_FAILURE(51)
  105. #define NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN            GENERATE_XPC_FAILURE(52)
  106. #define NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL    GENERATE_XPC_FAILURE(53)
  107. #ifdef XPC_IDISPATCH_SUPPORT
  108. // IDispatch support related errors
  109. #define NS_ERROR_XPC_COM_UNKNOWN                       GENERATE_XPC_FAILURE(54)
  110. #define NS_ERROR_XPC_COM_ERROR                         GENERATE_XPC_FAILURE(55)
  111. #define NS_ERROR_XPC_COM_INVALID_CLASS_ID              GENERATE_XPC_FAILURE(56)
  112. #define NS_ERROR_XPC_COM_CREATE_FAILED                 GENERATE_XPC_FAILURE(57)
  113. #define NS_ERROR_XPC_IDISPATCH_NOT_ENABLED             GENERATE_XPC_FAILURE(58)
  114. #endif
  115. // any new errors here should have an associated entry added in xpc.msg
  116. /***************************************************************************/
  117. class nsIXPCScriptable; /* forward declaration */
  118.  
  119. class nsIXPConnect; /* forward declaration */
  120.  
  121. class nsIXPConnectWrappedNative; /* forward declaration */
  122.  
  123. class nsIInterfaceInfo; /* forward declaration */
  124.  
  125. class nsIXPCSecurityManager; /* forward declaration */
  126.  
  127.  
  128. /* starting interface:    nsIXPConnectJSObjectHolder */
  129. #define NS_IXPCONNECTJSOBJECTHOLDER_IID_STR "8916a320-d118-11d3-8f3a-0010a4e73d9a"
  130.  
  131. #define NS_IXPCONNECTJSOBJECTHOLDER_IID \
  132.   {0x8916a320, 0xd118, 0x11d3, \
  133.     { 0x8f, 0x3a, 0x00, 0x10, 0xa4, 0xe7, 0x3d, 0x9a }}
  134.  
  135. /***************************************************************************/
  136. class NS_NO_VTABLE nsIXPConnectJSObjectHolder : public nsISupports {
  137.  public: 
  138.  
  139.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXPCONNECTJSOBJECTHOLDER_IID)
  140.  
  141.   /* readonly attribute JSObjectPtr JSObject; */
  142.   NS_IMETHOD GetJSObject(JSObject * *aJSObject) = 0;
  143.  
  144. };
  145.  
  146. /* Use this macro when declaring classes that implement this interface. */
  147. #define NS_DECL_NSIXPCONNECTJSOBJECTHOLDER \
  148.   NS_IMETHOD GetJSObject(JSObject * *aJSObject); 
  149.  
  150. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  151. #define NS_FORWARD_NSIXPCONNECTJSOBJECTHOLDER(_to) \
  152.   NS_IMETHOD GetJSObject(JSObject * *aJSObject) { return _to GetJSObject(aJSObject); } 
  153.  
  154. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  155. #define NS_FORWARD_SAFE_NSIXPCONNECTJSOBJECTHOLDER(_to) \
  156.   NS_IMETHOD GetJSObject(JSObject * *aJSObject) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetJSObject(aJSObject); } 
  157.  
  158. #if 0
  159. /* Use the code below as a template for the implementation class for this interface. */
  160.  
  161. /* Header file */
  162. class nsXPConnectJSObjectHolder : public nsIXPConnectJSObjectHolder
  163. {
  164. public:
  165.   NS_DECL_ISUPPORTS
  166.   NS_DECL_NSIXPCONNECTJSOBJECTHOLDER
  167.  
  168.   nsXPConnectJSObjectHolder();
  169.  
  170. private:
  171.   ~nsXPConnectJSObjectHolder();
  172.  
  173. protected:
  174.   /* additional members */
  175. };
  176.  
  177. /* Implementation file */
  178. NS_IMPL_ISUPPORTS1(nsXPConnectJSObjectHolder, nsIXPConnectJSObjectHolder)
  179.  
  180. nsXPConnectJSObjectHolder::nsXPConnectJSObjectHolder()
  181. {
  182.   /* member initializers and constructor code */
  183. }
  184.  
  185. nsXPConnectJSObjectHolder::~nsXPConnectJSObjectHolder()
  186. {
  187.   /* destructor code */
  188. }
  189.  
  190. /* readonly attribute JSObjectPtr JSObject; */
  191. NS_IMETHODIMP nsXPConnectJSObjectHolder::GetJSObject(JSObject * *aJSObject)
  192. {
  193.     return NS_ERROR_NOT_IMPLEMENTED;
  194. }
  195.  
  196. /* End of implementation class template. */
  197. #endif
  198.  
  199.  
  200. /* starting interface:    nsIXPConnectWrappedNative */
  201. #define NS_IXPCONNECTWRAPPEDNATIVE_IID_STR "215dbe02-94a7-11d2-ba58-00805f8a5dd7"
  202.  
  203. #define NS_IXPCONNECTWRAPPEDNATIVE_IID \
  204.   {0x215dbe02, 0x94a7, 0x11d2, \
  205.     { 0xba, 0x58, 0x00, 0x80, 0x5f, 0x8a, 0x5d, 0xd7 }}
  206.  
  207. class nsIXPConnectWrappedNative : public nsIXPConnectJSObjectHolder {
  208.  public: 
  209.  
  210.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXPCONNECTWRAPPEDNATIVE_IID)
  211.  
  212.   /* readonly attribute nsISupports Native; */
  213.   NS_IMETHOD GetNative(nsISupports * *aNative) = 0;
  214.  
  215.   /* readonly attribute JSObjectPtr JSObjectPrototype; */
  216.   NS_IMETHOD GetJSObjectPrototype(JSObject * *aJSObjectPrototype) = 0;
  217.  
  218.   /**
  219.      * These are here as an aid to nsIXPCScriptable implementors
  220.      */
  221.   /* readonly attribute nsIXPConnect XPConnect; */
  222.   NS_IMETHOD GetXPConnect(nsIXPConnect * *aXPConnect) = 0;
  223.  
  224.   /* nsIInterfaceInfo FindInterfaceWithMember (in JSVal nameID); */
  225.   NS_IMETHOD FindInterfaceWithMember(jsval nameID, nsIInterfaceInfo **_retval) = 0;
  226.  
  227.   /* nsIInterfaceInfo FindInterfaceWithName (in JSVal nameID); */
  228.   NS_IMETHOD FindInterfaceWithName(jsval nameID, nsIInterfaceInfo **_retval) = 0;
  229.  
  230.   /* void debugDump (in short depth); */
  231.   NS_IMETHOD DebugDump(PRInt16 depth) = 0;
  232.  
  233.   /* void refreshPrototype (); */
  234.   NS_IMETHOD RefreshPrototype(void) = 0;
  235.  
  236.   /* voidPtrPtr GetSecurityInfoAddress (); */
  237.   NS_IMETHOD GetSecurityInfoAddress(void* * *_retval) = 0;
  238.  
  239.     /**
  240.      * Faster access to the native object from C++.  Will never return null.
  241.      */
  242.     nsISupports* Native() const { return mIdentity; }
  243. protected:
  244.     nsISupports *mIdentity;
  245. public:
  246. };
  247.  
  248. /* Use this macro when declaring classes that implement this interface. */
  249. #define NS_DECL_NSIXPCONNECTWRAPPEDNATIVE \
  250.   NS_IMETHOD GetNative(nsISupports * *aNative); \
  251.   NS_IMETHOD GetJSObjectPrototype(JSObject * *aJSObjectPrototype); \
  252.   NS_IMETHOD GetXPConnect(nsIXPConnect * *aXPConnect); \
  253.   NS_IMETHOD FindInterfaceWithMember(jsval nameID, nsIInterfaceInfo **_retval); \
  254.   NS_IMETHOD FindInterfaceWithName(jsval nameID, nsIInterfaceInfo **_retval); \
  255.   NS_IMETHOD DebugDump(PRInt16 depth); \
  256.   NS_IMETHOD RefreshPrototype(void); \
  257.   NS_IMETHOD GetSecurityInfoAddress(void* * *_retval); \
  258.  
  259. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  260. #define NS_FORWARD_NSIXPCONNECTWRAPPEDNATIVE(_to) \
  261.   NS_IMETHOD GetNative(nsISupports * *aNative) { return _to GetNative(aNative); } \
  262.   NS_IMETHOD GetJSObjectPrototype(JSObject * *aJSObjectPrototype) { return _to GetJSObjectPrototype(aJSObjectPrototype); } \
  263.   NS_IMETHOD GetXPConnect(nsIXPConnect * *aXPConnect) { return _to GetXPConnect(aXPConnect); } \
  264.   NS_IMETHOD FindInterfaceWithMember(jsval nameID, nsIInterfaceInfo **_retval) { return _to FindInterfaceWithMember(nameID, _retval); } \
  265.   NS_IMETHOD FindInterfaceWithName(jsval nameID, nsIInterfaceInfo **_retval) { return _to FindInterfaceWithName(nameID, _retval); } \
  266.   NS_IMETHOD DebugDump(PRInt16 depth) { return _to DebugDump(depth); } \
  267.   NS_IMETHOD RefreshPrototype(void) { return _to RefreshPrototype(); } \
  268.   NS_IMETHOD GetSecurityInfoAddress(void* * *_retval) { return _to GetSecurityInfoAddress(_retval); } \
  269.  
  270. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  271. #define NS_FORWARD_SAFE_NSIXPCONNECTWRAPPEDNATIVE(_to) \
  272.   NS_IMETHOD GetNative(nsISupports * *aNative) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNative(aNative); } \
  273.   NS_IMETHOD GetJSObjectPrototype(JSObject * *aJSObjectPrototype) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetJSObjectPrototype(aJSObjectPrototype); } \
  274.   NS_IMETHOD GetXPConnect(nsIXPConnect * *aXPConnect) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetXPConnect(aXPConnect); } \
  275.   NS_IMETHOD FindInterfaceWithMember(jsval nameID, nsIInterfaceInfo **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->FindInterfaceWithMember(nameID, _retval); } \
  276.   NS_IMETHOD FindInterfaceWithName(jsval nameID, nsIInterfaceInfo **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->FindInterfaceWithName(nameID, _retval); } \
  277.   NS_IMETHOD DebugDump(PRInt16 depth) { return !_to ? NS_ERROR_NULL_POINTER : _to->DebugDump(depth); } \
  278.   NS_IMETHOD RefreshPrototype(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->RefreshPrototype(); } \
  279.   NS_IMETHOD GetSecurityInfoAddress(void* * *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSecurityInfoAddress(_retval); } \
  280.  
  281. #if 0
  282. /* Use the code below as a template for the implementation class for this interface. */
  283.  
  284. /* Header file */
  285. class nsXPConnectWrappedNative : public nsIXPConnectWrappedNative
  286. {
  287. public:
  288.   NS_DECL_ISUPPORTS
  289.   NS_DECL_NSIXPCONNECTWRAPPEDNATIVE
  290.  
  291.   nsXPConnectWrappedNative();
  292.  
  293. private:
  294.   ~nsXPConnectWrappedNative();
  295.  
  296. protected:
  297.   /* additional members */
  298. };
  299.  
  300. /* Implementation file */
  301. NS_IMPL_ISUPPORTS1(nsXPConnectWrappedNative, nsIXPConnectWrappedNative)
  302.  
  303. nsXPConnectWrappedNative::nsXPConnectWrappedNative()
  304. {
  305.   /* member initializers and constructor code */
  306. }
  307.  
  308. nsXPConnectWrappedNative::~nsXPConnectWrappedNative()
  309. {
  310.   /* destructor code */
  311. }
  312.  
  313. /* readonly attribute nsISupports Native; */
  314. NS_IMETHODIMP nsXPConnectWrappedNative::GetNative(nsISupports * *aNative)
  315. {
  316.     return NS_ERROR_NOT_IMPLEMENTED;
  317. }
  318.  
  319. /* readonly attribute JSObjectPtr JSObjectPrototype; */
  320. NS_IMETHODIMP nsXPConnectWrappedNative::GetJSObjectPrototype(JSObject * *aJSObjectPrototype)
  321. {
  322.     return NS_ERROR_NOT_IMPLEMENTED;
  323. }
  324.  
  325. /* readonly attribute nsIXPConnect XPConnect; */
  326. NS_IMETHODIMP nsXPConnectWrappedNative::GetXPConnect(nsIXPConnect * *aXPConnect)
  327. {
  328.     return NS_ERROR_NOT_IMPLEMENTED;
  329. }
  330.  
  331. /* nsIInterfaceInfo FindInterfaceWithMember (in JSVal nameID); */
  332. NS_IMETHODIMP nsXPConnectWrappedNative::FindInterfaceWithMember(jsval nameID, nsIInterfaceInfo **_retval)
  333. {
  334.     return NS_ERROR_NOT_IMPLEMENTED;
  335. }
  336.  
  337. /* nsIInterfaceInfo FindInterfaceWithName (in JSVal nameID); */
  338. NS_IMETHODIMP nsXPConnectWrappedNative::FindInterfaceWithName(jsval nameID, nsIInterfaceInfo **_retval)
  339. {
  340.     return NS_ERROR_NOT_IMPLEMENTED;
  341. }
  342.  
  343. /* void debugDump (in short depth); */
  344. NS_IMETHODIMP nsXPConnectWrappedNative::DebugDump(PRInt16 depth)
  345. {
  346.     return NS_ERROR_NOT_IMPLEMENTED;
  347. }
  348.  
  349. /* void refreshPrototype (); */
  350. NS_IMETHODIMP nsXPConnectWrappedNative::RefreshPrototype()
  351. {
  352.     return NS_ERROR_NOT_IMPLEMENTED;
  353. }
  354.  
  355. /* voidPtrPtr GetSecurityInfoAddress (); */
  356. NS_IMETHODIMP nsXPConnectWrappedNative::GetSecurityInfoAddress(void* * *_retval)
  357. {
  358.     return NS_ERROR_NOT_IMPLEMENTED;
  359. }
  360.  
  361. /* End of implementation class template. */
  362. #endif
  363.  
  364. inline
  365. const nsQueryInterface
  366. do_QueryWrappedNative(nsIXPConnectWrappedNative *aWrappedNative)
  367. {
  368.     return nsQueryInterface(aWrappedNative->Native());
  369. }
  370. inline
  371. const nsQueryInterfaceWithError
  372. do_QueryWrappedNative(nsIXPConnectWrappedNative *aWrappedNative,
  373.                       nsresult *aError)
  374. {
  375.     return nsQueryInterfaceWithError(aWrappedNative->Native(), aError);
  376. }
  377.  
  378. /* starting interface:    nsIXPConnectWrappedJS */
  379. #define NS_IXPCONNECTWRAPPEDJS_IID_STR "bed52030-bca6-11d2-ba79-00805f8a5dd7"
  380.  
  381. #define NS_IXPCONNECTWRAPPEDJS_IID \
  382.   {0xbed52030, 0xbca6, 0x11d2, \
  383.     { 0xba, 0x79, 0x00, 0x80, 0x5f, 0x8a, 0x5d, 0xd7 }}
  384.  
  385. class NS_NO_VTABLE nsIXPConnectWrappedJS : public nsIXPConnectJSObjectHolder {
  386.  public: 
  387.  
  388.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXPCONNECTWRAPPEDJS_IID)
  389.  
  390.   /* readonly attribute nsIInterfaceInfo InterfaceInfo; */
  391.   NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo * *aInterfaceInfo) = 0;
  392.  
  393.   /* readonly attribute nsIIDPtr InterfaceIID; */
  394.   NS_IMETHOD GetInterfaceIID(nsIID * *aInterfaceIID) = 0;
  395.  
  396.   /* void debugDump (in short depth); */
  397.   NS_IMETHOD DebugDump(PRInt16 depth) = 0;
  398.  
  399.   /* void aggregatedQueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
  400.   NS_IMETHOD AggregatedQueryInterface(const nsIID & uuid, void * *result) = 0;
  401.  
  402. };
  403.  
  404. /* Use this macro when declaring classes that implement this interface. */
  405. #define NS_DECL_NSIXPCONNECTWRAPPEDJS \
  406.   NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo * *aInterfaceInfo); \
  407.   NS_IMETHOD GetInterfaceIID(nsIID * *aInterfaceIID); \
  408.   NS_IMETHOD DebugDump(PRInt16 depth); \
  409.   NS_IMETHOD AggregatedQueryInterface(const nsIID & uuid, void * *result); 
  410.  
  411. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  412. #define NS_FORWARD_NSIXPCONNECTWRAPPEDJS(_to) \
  413.   NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo * *aInterfaceInfo) { return _to GetInterfaceInfo(aInterfaceInfo); } \
  414.   NS_IMETHOD GetInterfaceIID(nsIID * *aInterfaceIID) { return _to GetInterfaceIID(aInterfaceIID); } \
  415.   NS_IMETHOD DebugDump(PRInt16 depth) { return _to DebugDump(depth); } \
  416.   NS_IMETHOD AggregatedQueryInterface(const nsIID & uuid, void * *result) { return _to AggregatedQueryInterface(uuid, result); } 
  417.  
  418. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  419. #define NS_FORWARD_SAFE_NSIXPCONNECTWRAPPEDJS(_to) \
  420.   NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo * *aInterfaceInfo) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetInterfaceInfo(aInterfaceInfo); } \
  421.   NS_IMETHOD GetInterfaceIID(nsIID * *aInterfaceIID) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetInterfaceIID(aInterfaceIID); } \
  422.   NS_IMETHOD DebugDump(PRInt16 depth) { return !_to ? NS_ERROR_NULL_POINTER : _to->DebugDump(depth); } \
  423.   NS_IMETHOD AggregatedQueryInterface(const nsIID & uuid, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->AggregatedQueryInterface(uuid, result); } 
  424.  
  425. #if 0
  426. /* Use the code below as a template for the implementation class for this interface. */
  427.  
  428. /* Header file */
  429. class nsXPConnectWrappedJS : public nsIXPConnectWrappedJS
  430. {
  431. public:
  432.   NS_DECL_ISUPPORTS
  433.   NS_DECL_NSIXPCONNECTWRAPPEDJS
  434.  
  435.   nsXPConnectWrappedJS();
  436.  
  437. private:
  438.   ~nsXPConnectWrappedJS();
  439.  
  440. protected:
  441.   /* additional members */
  442. };
  443.  
  444. /* Implementation file */
  445. NS_IMPL_ISUPPORTS1(nsXPConnectWrappedJS, nsIXPConnectWrappedJS)
  446.  
  447. nsXPConnectWrappedJS::nsXPConnectWrappedJS()
  448. {
  449.   /* member initializers and constructor code */
  450. }
  451.  
  452. nsXPConnectWrappedJS::~nsXPConnectWrappedJS()
  453. {
  454.   /* destructor code */
  455. }
  456.  
  457. /* readonly attribute nsIInterfaceInfo InterfaceInfo; */
  458. NS_IMETHODIMP nsXPConnectWrappedJS::GetInterfaceInfo(nsIInterfaceInfo * *aInterfaceInfo)
  459. {
  460.     return NS_ERROR_NOT_IMPLEMENTED;
  461. }
  462.  
  463. /* readonly attribute nsIIDPtr InterfaceIID; */
  464. NS_IMETHODIMP nsXPConnectWrappedJS::GetInterfaceIID(nsIID * *aInterfaceIID)
  465. {
  466.     return NS_ERROR_NOT_IMPLEMENTED;
  467. }
  468.  
  469. /* void debugDump (in short depth); */
  470. NS_IMETHODIMP nsXPConnectWrappedJS::DebugDump(PRInt16 depth)
  471. {
  472.     return NS_ERROR_NOT_IMPLEMENTED;
  473. }
  474.  
  475. /* void aggregatedQueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
  476. NS_IMETHODIMP nsXPConnectWrappedJS::AggregatedQueryInterface(const nsIID & uuid, void * *result)
  477. {
  478.     return NS_ERROR_NOT_IMPLEMENTED;
  479. }
  480.  
  481. /* End of implementation class template. */
  482. #endif
  483.  
  484.  
  485. /* starting interface:    nsIXPCNativeCallContext */
  486. #define NS_IXPCNATIVECALLCONTEXT_IID_STR "0fa68a60-8289-11d3-bb1a-00805f8a5dd7"
  487.  
  488. #define NS_IXPCNATIVECALLCONTEXT_IID \
  489.   {0x0fa68a60, 0x8289, 0x11d3, \
  490.     { 0xbb, 0x1a, 0x00, 0x80, 0x5f, 0x8a, 0x5d, 0xd7 }}
  491.  
  492. /***************************************************************************/
  493. /**
  494. * This is a somewhat special interface. It is available from the global
  495. * nsIXPConnect object when native methods have been called. It is only relevant
  496. * to the currently called native method on the given JSContext/thread. Holding
  497. * a reference past that time (or while other native methods are being called)
  498. * will not assure access to this data.
  499. */
  500. class NS_NO_VTABLE nsIXPCNativeCallContext : public nsISupports {
  501.  public: 
  502.  
  503.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXPCNATIVECALLCONTEXT_IID)
  504.  
  505.   /* readonly attribute nsISupports Callee; */
  506.   NS_IMETHOD GetCallee(nsISupports * *aCallee) = 0;
  507.  
  508.   /* readonly attribute PRUint16 CalleeMethodIndex; */
  509.   NS_IMETHOD GetCalleeMethodIndex(PRUint16 *aCalleeMethodIndex) = 0;
  510.  
  511.   /* readonly attribute nsIXPConnectWrappedNative CalleeWrapper; */
  512.   NS_IMETHOD GetCalleeWrapper(nsIXPConnectWrappedNative * *aCalleeWrapper) = 0;
  513.  
  514.   /* readonly attribute JSContextPtr JSContext; */
  515.   NS_IMETHOD GetJSContext(JSContext * *aJSContext) = 0;
  516.  
  517.   /* readonly attribute PRUint32 Argc; */
  518.   NS_IMETHOD GetArgc(PRUint32 *aArgc) = 0;
  519.  
  520.   /* readonly attribute JSValPtr ArgvPtr; */
  521.   NS_IMETHOD GetArgvPtr(jsval * *aArgvPtr) = 0;
  522.  
  523.   /**
  524.     * This may be NULL if the JS caller is ignoring the result of the call.
  525.     */
  526.   /* readonly attribute JSValPtr RetValPtr; */
  527.   NS_IMETHOD GetRetValPtr(jsval * *aRetValPtr) = 0;
  528.  
  529.   /**
  530.     * Set this if JS_SetPendingException has been called. Return NS_OK or
  531.     * else this will be ignored and the native method's nsresult will be
  532.     * converted into an exception and thrown into JS as is the normal case.
  533.     */
  534.   /* attribute PRBool ExceptionWasThrown; */
  535.   NS_IMETHOD GetExceptionWasThrown(PRBool *aExceptionWasThrown) = 0;
  536.   NS_IMETHOD SetExceptionWasThrown(PRBool aExceptionWasThrown) = 0;
  537.  
  538.   /**
  539.     * Set this to indicate that the callee has directly set the return value
  540.     * (using RetValPtr and the JSAPI). If set then xpconnect will not attempt
  541.     * to overwrite it with the converted retval from the C++ callee.
  542.     */
  543.   /* attribute PRBool ReturnValueWasSet; */
  544.   NS_IMETHOD GetReturnValueWasSet(PRBool *aReturnValueWasSet) = 0;
  545.   NS_IMETHOD SetReturnValueWasSet(PRBool aReturnValueWasSet) = 0;
  546.  
  547.   /* readonly attribute nsIInterfaceInfo CalleeInterface; */
  548.   NS_IMETHOD GetCalleeInterface(nsIInterfaceInfo * *aCalleeInterface) = 0;
  549.  
  550.   /* readonly attribute nsIClassInfo CalleeClassInfo; */
  551.   NS_IMETHOD GetCalleeClassInfo(nsIClassInfo * *aCalleeClassInfo) = 0;
  552.  
  553. };
  554.  
  555. /* Use this macro when declaring classes that implement this interface. */
  556. #define NS_DECL_NSIXPCNATIVECALLCONTEXT \
  557.   NS_IMETHOD GetCallee(nsISupports * *aCallee); \
  558.   NS_IMETHOD GetCalleeMethodIndex(PRUint16 *aCalleeMethodIndex); \
  559.   NS_IMETHOD GetCalleeWrapper(nsIXPConnectWrappedNative * *aCalleeWrapper); \
  560.   NS_IMETHOD GetJSContext(JSContext * *aJSContext); \
  561.   NS_IMETHOD GetArgc(PRUint32 *aArgc); \
  562.   NS_IMETHOD GetArgvPtr(jsval * *aArgvPtr); \
  563.   NS_IMETHOD GetRetValPtr(jsval * *aRetValPtr); \
  564.   NS_IMETHOD GetExceptionWasThrown(PRBool *aExceptionWasThrown); \
  565.   NS_IMETHOD SetExceptionWasThrown(PRBool aExceptionWasThrown); \
  566.   NS_IMETHOD GetReturnValueWasSet(PRBool *aReturnValueWasSet); \
  567.   NS_IMETHOD SetReturnValueWasSet(PRBool aReturnValueWasSet); \
  568.   NS_IMETHOD GetCalleeInterface(nsIInterfaceInfo * *aCalleeInterface); \
  569.   NS_IMETHOD GetCalleeClassInfo(nsIClassInfo * *aCalleeClassInfo); 
  570.  
  571. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  572. #define NS_FORWARD_NSIXPCNATIVECALLCONTEXT(_to) \
  573.   NS_IMETHOD GetCallee(nsISupports * *aCallee) { return _to GetCallee(aCallee); } \
  574.   NS_IMETHOD GetCalleeMethodIndex(PRUint16 *aCalleeMethodIndex) { return _to GetCalleeMethodIndex(aCalleeMethodIndex); } \
  575.   NS_IMETHOD GetCalleeWrapper(nsIXPConnectWrappedNative * *aCalleeWrapper) { return _to GetCalleeWrapper(aCalleeWrapper); } \
  576.   NS_IMETHOD GetJSContext(JSContext * *aJSContext) { return _to GetJSContext(aJSContext); } \
  577.   NS_IMETHOD GetArgc(PRUint32 *aArgc) { return _to GetArgc(aArgc); } \
  578.   NS_IMETHOD GetArgvPtr(jsval * *aArgvPtr) { return _to GetArgvPtr(aArgvPtr); } \
  579.   NS_IMETHOD GetRetValPtr(jsval * *aRetValPtr) { return _to GetRetValPtr(aRetValPtr); } \
  580.   NS_IMETHOD GetExceptionWasThrown(PRBool *aExceptionWasThrown) { return _to GetExceptionWasThrown(aExceptionWasThrown); } \
  581.   NS_IMETHOD SetExceptionWasThrown(PRBool aExceptionWasThrown) { return _to SetExceptionWasThrown(aExceptionWasThrown); } \
  582.   NS_IMETHOD GetReturnValueWasSet(PRBool *aReturnValueWasSet) { return _to GetReturnValueWasSet(aReturnValueWasSet); } \
  583.   NS_IMETHOD SetReturnValueWasSet(PRBool aReturnValueWasSet) { return _to SetReturnValueWasSet(aReturnValueWasSet); } \
  584.   NS_IMETHOD GetCalleeInterface(nsIInterfaceInfo * *aCalleeInterface) { return _to GetCalleeInterface(aCalleeInterface); } \
  585.   NS_IMETHOD GetCalleeClassInfo(nsIClassInfo * *aCalleeClassInfo) { return _to GetCalleeClassInfo(aCalleeClassInfo); } 
  586.  
  587. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  588. #define NS_FORWARD_SAFE_NSIXPCNATIVECALLCONTEXT(_to) \
  589.   NS_IMETHOD GetCallee(nsISupports * *aCallee) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCallee(aCallee); } \
  590.   NS_IMETHOD GetCalleeMethodIndex(PRUint16 *aCalleeMethodIndex) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCalleeMethodIndex(aCalleeMethodIndex); } \
  591.   NS_IMETHOD GetCalleeWrapper(nsIXPConnectWrappedNative * *aCalleeWrapper) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCalleeWrapper(aCalleeWrapper); } \
  592.   NS_IMETHOD GetJSContext(JSContext * *aJSContext) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetJSContext(aJSContext); } \
  593.   NS_IMETHOD GetArgc(PRUint32 *aArgc) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetArgc(aArgc); } \
  594.   NS_IMETHOD GetArgvPtr(jsval * *aArgvPtr) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetArgvPtr(aArgvPtr); } \
  595.   NS_IMETHOD GetRetValPtr(jsval * *aRetValPtr) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRetValPtr(aRetValPtr); } \
  596.   NS_IMETHOD GetExceptionWasThrown(PRBool *aExceptionWasThrown) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetExceptionWasThrown(aExceptionWasThrown); } \
  597.   NS_IMETHOD SetExceptionWasThrown(PRBool aExceptionWasThrown) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetExceptionWasThrown(aExceptionWasThrown); } \
  598.   NS_IMETHOD GetReturnValueWasSet(PRBool *aReturnValueWasSet) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetReturnValueWasSet(aReturnValueWasSet); } \
  599.   NS_IMETHOD SetReturnValueWasSet(PRBool aReturnValueWasSet) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetReturnValueWasSet(aReturnValueWasSet); } \
  600.   NS_IMETHOD GetCalleeInterface(nsIInterfaceInfo * *aCalleeInterface) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCalleeInterface(aCalleeInterface); } \
  601.   NS_IMETHOD GetCalleeClassInfo(nsIClassInfo * *aCalleeClassInfo) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCalleeClassInfo(aCalleeClassInfo); } 
  602.  
  603. #if 0
  604. /* Use the code below as a template for the implementation class for this interface. */
  605.  
  606. /* Header file */
  607. class nsXPCNativeCallContext : public nsIXPCNativeCallContext
  608. {
  609. public:
  610.   NS_DECL_ISUPPORTS
  611.   NS_DECL_NSIXPCNATIVECALLCONTEXT
  612.  
  613.   nsXPCNativeCallContext();
  614.  
  615. private:
  616.   ~nsXPCNativeCallContext();
  617.  
  618. protected:
  619.   /* additional members */
  620. };
  621.  
  622. /* Implementation file */
  623. NS_IMPL_ISUPPORTS1(nsXPCNativeCallContext, nsIXPCNativeCallContext)
  624.  
  625. nsXPCNativeCallContext::nsXPCNativeCallContext()
  626. {
  627.   /* member initializers and constructor code */
  628. }
  629.  
  630. nsXPCNativeCallContext::~nsXPCNativeCallContext()
  631. {
  632.   /* destructor code */
  633. }
  634.  
  635. /* readonly attribute nsISupports Callee; */
  636. NS_IMETHODIMP nsXPCNativeCallContext::GetCallee(nsISupports * *aCallee)
  637. {
  638.     return NS_ERROR_NOT_IMPLEMENTED;
  639. }
  640.  
  641. /* readonly attribute PRUint16 CalleeMethodIndex; */
  642. NS_IMETHODIMP nsXPCNativeCallContext::GetCalleeMethodIndex(PRUint16 *aCalleeMethodIndex)
  643. {
  644.     return NS_ERROR_NOT_IMPLEMENTED;
  645. }
  646.  
  647. /* readonly attribute nsIXPConnectWrappedNative CalleeWrapper; */
  648. NS_IMETHODIMP nsXPCNativeCallContext::GetCalleeWrapper(nsIXPConnectWrappedNative * *aCalleeWrapper)
  649. {
  650.     return NS_ERROR_NOT_IMPLEMENTED;
  651. }
  652.  
  653. /* readonly attribute JSContextPtr JSContext; */
  654. NS_IMETHODIMP nsXPCNativeCallContext::GetJSContext(JSContext * *aJSContext)
  655. {
  656.     return NS_ERROR_NOT_IMPLEMENTED;
  657. }
  658.  
  659. /* readonly attribute PRUint32 Argc; */
  660. NS_IMETHODIMP nsXPCNativeCallContext::GetArgc(PRUint32 *aArgc)
  661. {
  662.     return NS_ERROR_NOT_IMPLEMENTED;
  663. }
  664.  
  665. /* readonly attribute JSValPtr ArgvPtr; */
  666. NS_IMETHODIMP nsXPCNativeCallContext::GetArgvPtr(jsval * *aArgvPtr)
  667. {
  668.     return NS_ERROR_NOT_IMPLEMENTED;
  669. }
  670.  
  671. /* readonly attribute JSValPtr RetValPtr; */
  672. NS_IMETHODIMP nsXPCNativeCallContext::GetRetValPtr(jsval * *aRetValPtr)
  673. {
  674.     return NS_ERROR_NOT_IMPLEMENTED;
  675. }
  676.  
  677. /* attribute PRBool ExceptionWasThrown; */
  678. NS_IMETHODIMP nsXPCNativeCallContext::GetExceptionWasThrown(PRBool *aExceptionWasThrown)
  679. {
  680.     return NS_ERROR_NOT_IMPLEMENTED;
  681. }
  682. NS_IMETHODIMP nsXPCNativeCallContext::SetExceptionWasThrown(PRBool aExceptionWasThrown)
  683. {
  684.     return NS_ERROR_NOT_IMPLEMENTED;
  685. }
  686.  
  687. /* attribute PRBool ReturnValueWasSet; */
  688. NS_IMETHODIMP nsXPCNativeCallContext::GetReturnValueWasSet(PRBool *aReturnValueWasSet)
  689. {
  690.     return NS_ERROR_NOT_IMPLEMENTED;
  691. }
  692. NS_IMETHODIMP nsXPCNativeCallContext::SetReturnValueWasSet(PRBool aReturnValueWasSet)
  693. {
  694.     return NS_ERROR_NOT_IMPLEMENTED;
  695. }
  696.  
  697. /* readonly attribute nsIInterfaceInfo CalleeInterface; */
  698. NS_IMETHODIMP nsXPCNativeCallContext::GetCalleeInterface(nsIInterfaceInfo * *aCalleeInterface)
  699. {
  700.     return NS_ERROR_NOT_IMPLEMENTED;
  701. }
  702.  
  703. /* readonly attribute nsIClassInfo CalleeClassInfo; */
  704. NS_IMETHODIMP nsXPCNativeCallContext::GetCalleeClassInfo(nsIClassInfo * *aCalleeClassInfo)
  705. {
  706.     return NS_ERROR_NOT_IMPLEMENTED;
  707. }
  708.  
  709. /* End of implementation class template. */
  710. #endif
  711.  
  712.  
  713. /* starting interface:    nsIXPCWrappedJSObjectGetter */
  714. #define NS_IXPCWRAPPEDJSOBJECTGETTER_IID_STR "254bb2e0-6439-11d4-8fe0-0010a4e73d9a"
  715.  
  716. #define NS_IXPCWRAPPEDJSOBJECTGETTER_IID \
  717.   {0x254bb2e0, 0x6439, 0x11d4, \
  718.     { 0x8f, 0xe0, 0x00, 0x10, 0xa4, 0xe7, 0x3d, 0x9a }}
  719.  
  720. /***************************************************************************/
  721. /**
  722.  * This is a sort of a placeholder interface. It is not intended to be
  723.  * implemented. It exists to give the nsIXPCSecurityManager an iid on
  724.  * which to gate a specific activity in XPConnect.
  725.  *
  726.  * That activity is...
  727.  *
  728.  * When JavaScript code uses a component that is itself implemeted in
  729.  * JavaScript then XPConnect will build a wrapper rather than directly
  730.  * expose the JSObject of the component. This allows components implemented
  731.  * in JavaScript to 'look' just like any other xpcom component (from the
  732.  * perspective of the JavaScript caller). This insulates the component from
  733.  * the caller and hides any properties or methods that are not part of the
  734.  * interface as declared in xpidl. Usually this is a good thing.
  735.  *
  736.  * However, in some cases it is useful to allow the JS caller access to the
  737.  * JS component's underlying implementation. In order to facilitate this
  738.  * XPConnect supports the 'wrappedJSObject' property. The caller code can do:
  739.  *
  740.  * // 'foo' is some xpcom component (that might be implemented in JS).
  741.  * try {
  742.  *   var bar = foo.wrappedJSObject;
  743.  *   if(bar) {
  744.  *      // bar is the underlying JSObject. Do stuff with it here.
  745.  *   }
  746.  * } catch(e) {
  747.  *   // security exception?
  748.  * }
  749.  *
  750.  * Recall that 'foo' above is an XPConnect wrapper, not the underlying JS
  751.  * object. The property get "foo.wrappedJSObject" will only succeed if three
  752.  * conditions are met:
  753.  *
  754.  * 1) 'foo' really is an XPConnect wrapper around a JSObject.
  755.  * 2) The underlying JSObject actually implements a "wrappedJSObject"
  756.  *    property that returns a JSObject. This is called by XPConnect. This
  757.  *    restriction allows wrapped objects to only allow access to the underlying
  758.  *    JSObject if they choose to do so. Ususally this just means that 'foo'
  759.  *    would have a property tht looks like:
  760.  *       this.wrappedJSObject = this.
  761.  * 3) The implemementation of nsIXPCSecurityManager (if installed) allows
  762.  *    a property get on the interface below. Although the JSObject need not
  763.  *    implement 'nsIXPCWrappedJSObjectGetter', XPConnect will ask the
  764.  *    security manager if it is OK for the caller to access the only method
  765.  *    in nsIXPCWrappedJSObjectGetter before allowing the activity. This fits
  766.  *    in with the security manager paradigm and makes control over accessing
  767.  *    the property on this interface the control factor for getting the
  768.  *    underlying wrapped JSObject of a JS component from JS code.
  769.  *
  770.  * Notes:
  771.  *
  772.  * a) If 'foo' above were the underlying JSObject and not a wrapper at all,
  773.  *    then this all just works and XPConnect is not part of the picture at all.
  774.  * b) One might ask why 'foo' should not just implement an interface through
  775.  *    which callers might get at the underlying object. There are three reasons:
  776.  *   i)   XPConnect would still have to do magic since JSObject is not a
  777.  *        scriptable type.
  778.  *   ii)  JS Components might use aggregation (like C++ objects) and have
  779.  *        different JSObjects for different interfaces 'within' an aggregate
  780.  *        object. But, using an additional interface only allows returning one
  781.  *        underlying JSObject. However, this allows for the possibility that
  782.  *        each of the aggregte JSObjects could return something different.
  783.  *        Note that one might do: this.wrappedJSObject = someOtherObject;
  784.  *   iii) Avoiding the explicit interface makes it easier for both the caller
  785.  *        and the component.
  786.  *
  787.  *  Anyway, some future implementation of nsIXPCSecurityManager might want
  788.  *  do special processing on 'nsIXPCSecurityManager::CanGetProperty' when
  789.  *  the interface id is that of nsIXPCWrappedJSObjectGetter.
  790.  */
  791. class NS_NO_VTABLE nsIXPCWrappedJSObjectGetter : public nsISupports {
  792.  public: 
  793.  
  794.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXPCWRAPPEDJSOBJECTGETTER_IID)
  795.  
  796.   /* readonly attribute nsISupports neverCalled; */
  797.   NS_IMETHOD GetNeverCalled(nsISupports * *aNeverCalled) = 0;
  798.  
  799. };
  800.  
  801. /* Use this macro when declaring classes that implement this interface. */
  802. #define NS_DECL_NSIXPCWRAPPEDJSOBJECTGETTER \
  803.   NS_IMETHOD GetNeverCalled(nsISupports * *aNeverCalled); 
  804.  
  805. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  806. #define NS_FORWARD_NSIXPCWRAPPEDJSOBJECTGETTER(_to) \
  807.   NS_IMETHOD GetNeverCalled(nsISupports * *aNeverCalled) { return _to GetNeverCalled(aNeverCalled); } 
  808.  
  809. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  810. #define NS_FORWARD_SAFE_NSIXPCWRAPPEDJSOBJECTGETTER(_to) \
  811.   NS_IMETHOD GetNeverCalled(nsISupports * *aNeverCalled) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNeverCalled(aNeverCalled); } 
  812.  
  813. #if 0
  814. /* Use the code below as a template for the implementation class for this interface. */
  815.  
  816. /* Header file */
  817. class nsXPCWrappedJSObjectGetter : public nsIXPCWrappedJSObjectGetter
  818. {
  819. public:
  820.   NS_DECL_ISUPPORTS
  821.   NS_DECL_NSIXPCWRAPPEDJSOBJECTGETTER
  822.  
  823.   nsXPCWrappedJSObjectGetter();
  824.  
  825. private:
  826.   ~nsXPCWrappedJSObjectGetter();
  827.  
  828. protected:
  829.   /* additional members */
  830. };
  831.  
  832. /* Implementation file */
  833. NS_IMPL_ISUPPORTS1(nsXPCWrappedJSObjectGetter, nsIXPCWrappedJSObjectGetter)
  834.  
  835. nsXPCWrappedJSObjectGetter::nsXPCWrappedJSObjectGetter()
  836. {
  837.   /* member initializers and constructor code */
  838. }
  839.  
  840. nsXPCWrappedJSObjectGetter::~nsXPCWrappedJSObjectGetter()
  841. {
  842.   /* destructor code */
  843. }
  844.  
  845. /* readonly attribute nsISupports neverCalled; */
  846. NS_IMETHODIMP nsXPCWrappedJSObjectGetter::GetNeverCalled(nsISupports * *aNeverCalled)
  847. {
  848.     return NS_ERROR_NOT_IMPLEMENTED;
  849. }
  850.  
  851. /* End of implementation class template. */
  852. #endif
  853.  
  854.  
  855. /* starting interface:    nsIXPCFunctionThisTranslator */
  856. #define NS_IXPCFUNCTIONTHISTRANSLATOR_IID_STR "039ef260-2a0d-11d5-90a7-0010a4e73d9a"
  857.  
  858. #define NS_IXPCFUNCTIONTHISTRANSLATOR_IID \
  859.   {0x039ef260, 0x2a0d, 0x11d5, \
  860.     { 0x90, 0xa7, 0x00, 0x10, 0xa4, 0xe7, 0x3d, 0x9a }}
  861.  
  862. /***************************************************************************/
  863. class NS_NO_VTABLE nsIXPCFunctionThisTranslator : public nsISupports {
  864.  public: 
  865.  
  866.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXPCFUNCTIONTHISTRANSLATOR_IID)
  867.  
  868.   /* nsISupports TranslateThis (in nsISupports aInitialThis, in nsIInterfaceInfo aInterfaceInfo, in PRUint16 aMethodIndex, out PRBool aHideFirstParamFromJS, out nsIIDPtr aIIDOfResult); */
  869.   NS_IMETHOD TranslateThis(nsISupports *aInitialThis, nsIInterfaceInfo *aInterfaceInfo, PRUint16 aMethodIndex, PRBool *aHideFirstParamFromJS, nsIID * *aIIDOfResult, nsISupports **_retval) = 0;
  870.  
  871. };
  872.  
  873. /* Use this macro when declaring classes that implement this interface. */
  874. #define NS_DECL_NSIXPCFUNCTIONTHISTRANSLATOR \
  875.   NS_IMETHOD TranslateThis(nsISupports *aInitialThis, nsIInterfaceInfo *aInterfaceInfo, PRUint16 aMethodIndex, PRBool *aHideFirstParamFromJS, nsIID * *aIIDOfResult, nsISupports **_retval); 
  876.  
  877. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  878. #define NS_FORWARD_NSIXPCFUNCTIONTHISTRANSLATOR(_to) \
  879.   NS_IMETHOD TranslateThis(nsISupports *aInitialThis, nsIInterfaceInfo *aInterfaceInfo, PRUint16 aMethodIndex, PRBool *aHideFirstParamFromJS, nsIID * *aIIDOfResult, nsISupports **_retval) { return _to TranslateThis(aInitialThis, aInterfaceInfo, aMethodIndex, aHideFirstParamFromJS, aIIDOfResult, _retval); } 
  880.  
  881. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  882. #define NS_FORWARD_SAFE_NSIXPCFUNCTIONTHISTRANSLATOR(_to) \
  883.   NS_IMETHOD TranslateThis(nsISupports *aInitialThis, nsIInterfaceInfo *aInterfaceInfo, PRUint16 aMethodIndex, PRBool *aHideFirstParamFromJS, nsIID * *aIIDOfResult, nsISupports **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->TranslateThis(aInitialThis, aInterfaceInfo, aMethodIndex, aHideFirstParamFromJS, aIIDOfResult, _retval); } 
  884.  
  885. #if 0
  886. /* Use the code below as a template for the implementation class for this interface. */
  887.  
  888. /* Header file */
  889. class nsXPCFunctionThisTranslator : public nsIXPCFunctionThisTranslator
  890. {
  891. public:
  892.   NS_DECL_ISUPPORTS
  893.   NS_DECL_NSIXPCFUNCTIONTHISTRANSLATOR
  894.  
  895.   nsXPCFunctionThisTranslator();
  896.  
  897. private:
  898.   ~nsXPCFunctionThisTranslator();
  899.  
  900. protected:
  901.   /* additional members */
  902. };
  903.  
  904. /* Implementation file */
  905. NS_IMPL_ISUPPORTS1(nsXPCFunctionThisTranslator, nsIXPCFunctionThisTranslator)
  906.  
  907. nsXPCFunctionThisTranslator::nsXPCFunctionThisTranslator()
  908. {
  909.   /* member initializers and constructor code */
  910. }
  911.  
  912. nsXPCFunctionThisTranslator::~nsXPCFunctionThisTranslator()
  913. {
  914.   /* destructor code */
  915. }
  916.  
  917. /* nsISupports TranslateThis (in nsISupports aInitialThis, in nsIInterfaceInfo aInterfaceInfo, in PRUint16 aMethodIndex, out PRBool aHideFirstParamFromJS, out nsIIDPtr aIIDOfResult); */
  918. NS_IMETHODIMP nsXPCFunctionThisTranslator::TranslateThis(nsISupports *aInitialThis, nsIInterfaceInfo *aInterfaceInfo, PRUint16 aMethodIndex, PRBool *aHideFirstParamFromJS, nsIID * *aIIDOfResult, nsISupports **_retval)
  919. {
  920.     return NS_ERROR_NOT_IMPLEMENTED;
  921. }
  922.  
  923. /* End of implementation class template. */
  924. #endif
  925.  
  926. // For use with the service manager
  927. // {CB6593E0-F9B2-11d2-BDD6-000064657374}
  928. #define NS_XPCONNECT_CID \
  929. { 0xcb6593e0, 0xf9b2, 0x11d2, \
  930.     { 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
  931.  
  932. /* starting interface:    nsIXPConnect */
  933. #define NS_IXPCONNECT_IID_STR "deb1d48e-7469-4b01-b186-d9854c7d3f2d"
  934.  
  935. #define NS_IXPCONNECT_IID \
  936.   {0xdeb1d48e, 0x7469, 0x4b01, \
  937.     { 0xb1, 0x86, 0xd9, 0x85, 0x4c, 0x7d, 0x3f, 0x2d }}
  938.  
  939. class nsIXPConnect : public nsISupports {
  940.  public: 
  941.  
  942.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXPCONNECT_IID)
  943.  
  944.   NS_DEFINE_STATIC_CID_ACCESSOR(NS_XPCONNECT_CID)
  945.   /***************************************************************************/
  946.   /* void initClasses (in JSContextPtr aJSContext, in JSObjectPtr aGlobalJSObj); */
  947.   NS_IMETHOD InitClasses(JSContext * aJSContext, JSObject * aGlobalJSObj) = 0;
  948.  
  949.   /* nsIXPConnectJSObjectHolder initClassesWithNewWrappedGlobal (in JSContextPtr aJSContext, in nsISupports aCOMObj, in nsIIDRef aIID, in PRUint32 aFlags); */
  950.   NS_IMETHOD InitClassesWithNewWrappedGlobal(JSContext * aJSContext, nsISupports *aCOMObj, const nsIID & aIID, PRUint32 aFlags, nsIXPConnectJSObjectHolder **_retval) = 0;
  951.  
  952.   enum { INIT_JS_STANDARD_CLASSES = 1U };
  953.  
  954.   enum { FLAG_SYSTEM_GLOBAL_OBJECT = 2U };
  955.  
  956.   /**
  957.     * wrapNative will create a new JSObject or return an existing one.
  958.     *
  959.     * The JSObject is returned inside a refcounted nsIXPConnectJSObjectHolder.
  960.     * As long as this holder is held the JSObject will be protected from
  961.     * collection by JavaScript's garbage collector. It is a good idea to
  962.     * transfer the JSObject to some equally protected place before releasing
  963.     * the holder (i.e. use JS_SetProperty to make this object a property of
  964.     * some other JSObject).
  965.     *
  966.     * This method now correctly deals with cases where the passed in xpcom
  967.     * object already has an associated JSObject for the cases:
  968.     *  1) The xpcom object has already been wrapped for use in the same scope
  969.     *     as an nsIXPConnectWrappedNative.
  970.     *  2) The xpcom object is in fact a nsIXPConnectWrappedJS and thus already
  971.     *     has an underlying JSObject.
  972.     *  3) The xpcom object implements nsIScriptObjectOwner; i.e. is an idlc
  973.     *     style DOM object for which we can call GetScriptObject to get the
  974.     *     JSObject it uses to represent itself into JavaScript.
  975.     *
  976.     * It *might* be possible to QueryInterface the nsIXPConnectJSObjectHolder
  977.     * returned by the method into a nsIXPConnectWrappedNative or a
  978.     * nsIXPConnectWrappedJS.
  979.     *
  980.     * This method will never wrap the JSObject involved in an
  981.     * XPCNativeWrapper before returning.
  982.     *
  983.     * Returns:
  984.     *    success:
  985.     *       NS_OK
  986.     *    failure:
  987.     *       NS_ERROR_XPC_BAD_CONVERT_NATIVE
  988.     *       NS_ERROR_XPC_CANT_GET_JSOBJECT_OF_DOM_OBJECT
  989.     *       NS_ERROR_FAILURE
  990.     */
  991.   /* nsIXPConnectJSObjectHolder wrapNative (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDRef aIID); */
  992.   NS_IMETHOD WrapNative(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectJSObjectHolder **_retval) = 0;
  993.  
  994.   /**
  995.     * wrapJS will yield a new or previously existing xpcom interface pointer
  996.     * to represent the JSObject passed in.
  997.     *
  998.     * This method now correctly deals with cases where the passed in JSObject
  999.     * already has an associated xpcom interface for the cases:
  1000.     *  1) The JSObject has already been wrapped as a nsIXPConnectWrappedJS.
  1001.     *  2) The JSObject is in fact a nsIXPConnectWrappedNative and thus already
  1002.     *     has an underlying xpcom object.
  1003.     *  3) The JSObject is of a jsclass which supports getting the nsISupports
  1004.     *     from the JSObject directly. This is used for idlc style objects
  1005.     *     (e.g. DOM objects).
  1006.     *
  1007.     * It *might* be possible to QueryInterface the resulting interface pointer
  1008.     * to nsIXPConnectWrappedJS.
  1009.     *
  1010.     * Returns:
  1011.     *   success:
  1012.     *     NS_OK
  1013.     *    failure:
  1014.     *       NS_ERROR_XPC_BAD_CONVERT_JS
  1015.     *       NS_ERROR_FAILURE
  1016.     */
  1017.   /* void wrapJS (in JSContextPtr aJSContext, in JSObjectPtr aJSObj, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
  1018.   NS_IMETHOD WrapJS(JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result) = 0;
  1019.  
  1020.   /**
  1021.     * This only succeeds if the JSObject is a nsIXPConnectWrappedNative.
  1022.     * A new wrapper is *never* constructed.
  1023.     */
  1024.   /* nsIXPConnectWrappedNative getWrappedNativeOfJSObject (in JSContextPtr aJSContext, in JSObjectPtr aJSObj); */
  1025.   NS_IMETHOD GetWrappedNativeOfJSObject(JSContext * aJSContext, JSObject * aJSObj, nsIXPConnectWrappedNative **_retval) = 0;
  1026.  
  1027.   /* void setSecurityManagerForJSContext (in JSContextPtr aJSContext, in nsIXPCSecurityManager aManager, in PRUint16 flags); */
  1028.   NS_IMETHOD SetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager *aManager, PRUint16 flags) = 0;
  1029.  
  1030.   /* void getSecurityManagerForJSContext (in JSContextPtr aJSContext, out nsIXPCSecurityManager aManager, out PRUint16 flags); */
  1031.   NS_IMETHOD GetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager **aManager, PRUint16 *flags) = 0;
  1032.  
  1033.   /**
  1034.     * The security manager to use when the current JSContext has no security
  1035.     * manager.
  1036.     */
  1037.   /* void setDefaultSecurityManager (in nsIXPCSecurityManager aManager, in PRUint16 flags); */
  1038.   NS_IMETHOD SetDefaultSecurityManager(nsIXPCSecurityManager *aManager, PRUint16 flags) = 0;
  1039.  
  1040.   /* void getDefaultSecurityManager (out nsIXPCSecurityManager aManager, out PRUint16 flags); */
  1041.   NS_IMETHOD GetDefaultSecurityManager(nsIXPCSecurityManager **aManager, PRUint16 *flags) = 0;
  1042.  
  1043.   /* nsIStackFrame createStackFrameLocation (in PRUint32 aLanguage, in string aFilename, in string aFunctionName, in PRInt32 aLineNumber, in nsIStackFrame aCaller); */
  1044.   NS_IMETHOD CreateStackFrameLocation(PRUint32 aLanguage, const char *aFilename, const char *aFunctionName, PRInt32 aLineNumber, nsIStackFrame *aCaller, nsIStackFrame **_retval) = 0;
  1045.  
  1046.   /**
  1047.     * XPConnect builds internal objects that parallel, and are one-to-one with,
  1048.     * the JSContexts in the JSRuntime. It builds these objects as needed.
  1049.     * This method tells XPConnect to resynchronize its representations with the
  1050.     * list of JSContexts currently 'alive' in the JSRuntime. This allows it
  1051.     * to cleanup any representations of JSContexts that are no longer valid.
  1052.     */
  1053.   /* void syncJSContexts (); */
  1054.   NS_IMETHOD SyncJSContexts(void) = 0;
  1055.  
  1056.   /* readonly attribute nsIStackFrame CurrentJSStack; */
  1057.   NS_IMETHOD GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack) = 0;
  1058.  
  1059.   /* readonly attribute nsIXPCNativeCallContext CurrentNativeCallContext; */
  1060.   NS_IMETHOD GetCurrentNativeCallContext(nsIXPCNativeCallContext * *aCurrentNativeCallContext) = 0;
  1061.  
  1062.   /* attribute nsIException PendingException; */
  1063.   NS_IMETHOD GetPendingException(nsIException * *aPendingException) = 0;
  1064.   NS_IMETHOD SetPendingException(nsIException * aPendingException) = 0;
  1065.  
  1066.   /* void debugDump (in short depth); */
  1067.   NS_IMETHOD DebugDump(PRInt16 depth) = 0;
  1068.  
  1069.   /* void debugDumpObject (in nsISupports aCOMObj, in short depth); */
  1070.   NS_IMETHOD DebugDumpObject(nsISupports *aCOMObj, PRInt16 depth) = 0;
  1071.  
  1072.   /* void debugDumpJSStack (in PRBool showArgs, in PRBool showLocals, in PRBool showThisProps); */
  1073.   NS_IMETHOD DebugDumpJSStack(PRBool showArgs, PRBool showLocals, PRBool showThisProps) = 0;
  1074.  
  1075.   /* void debugDumpEvalInJSStackFrame (in PRUint32 aFrameNumber, in string aSourceText); */
  1076.   NS_IMETHOD DebugDumpEvalInJSStackFrame(PRUint32 aFrameNumber, const char *aSourceText) = 0;
  1077.  
  1078.   /**
  1079.     * Set fallback JSContext to use when xpconnect can't find an appropriate
  1080.     * context to use to execute JavaScript.
  1081.     *
  1082.     * NOTE: This method is DEPRECATED. 
  1083.     *       Use nsIThreadJSContextStack::safeJSContext instead.
  1084.     */
  1085.   /* void setSafeJSContextForCurrentThread (in JSContextPtr cx); */
  1086.   NS_IMETHOD SetSafeJSContextForCurrentThread(JSContext * cx) = 0;
  1087.  
  1088.   /**
  1089.     * wrapJSAggregatedToNative is just like wrapJS except it is used in cases
  1090.     * where the JSObject is also aggregated to some native xpcom Object.
  1091.     * At present XBL is the only system that might want to do this.
  1092.     *
  1093.     * XXX write more!
  1094.     *
  1095.     * Returns:
  1096.     *   success:
  1097.     *     NS_OK
  1098.     *    failure:
  1099.     *       NS_ERROR_XPC_BAD_CONVERT_JS
  1100.     *       NS_ERROR_FAILURE
  1101.     */
  1102.   /* void wrapJSAggregatedToNative (in nsISupports aOuter, in JSContextPtr aJSContext, in JSObjectPtr aJSObj, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
  1103.   NS_IMETHOD WrapJSAggregatedToNative(nsISupports *aOuter, JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result) = 0;
  1104.  
  1105.   /**
  1106.     * This only succeeds if the native object is already wrapped by xpconnect.
  1107.     * A new wrapper is *never* constructed.
  1108.     */
  1109.   /* nsIXPConnectWrappedNative getWrappedNativeOfNativeObject (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDRef aIID); */
  1110.   NS_IMETHOD GetWrappedNativeOfNativeObject(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectWrappedNative **_retval) = 0;
  1111.  
  1112.   /* nsIXPCFunctionThisTranslator getFunctionThisTranslator (in nsIIDRef aIID); */
  1113.   NS_IMETHOD GetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator **_retval) = 0;
  1114.  
  1115.   /* nsIXPCFunctionThisTranslator setFunctionThisTranslator (in nsIIDRef aIID, in nsIXPCFunctionThisTranslator aTranslator); */
  1116.   NS_IMETHOD SetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator *aTranslator, nsIXPCFunctionThisTranslator **_retval) = 0;
  1117.  
  1118.   /* nsIXPConnectJSObjectHolder reparentWrappedNativeIfFound (in JSContextPtr aJSContext, in JSObjectPtr aScope, in JSObjectPtr aNewParent, in nsISupports aCOMObj); */
  1119.   NS_IMETHOD ReparentWrappedNativeIfFound(JSContext * aJSContext, JSObject * aScope, JSObject * aNewParent, nsISupports *aCOMObj, nsIXPConnectJSObjectHolder **_retval) = 0;
  1120.  
  1121.   /* void clearAllWrappedNativeSecurityPolicies (); */
  1122.   NS_IMETHOD ClearAllWrappedNativeSecurityPolicies(void) = 0;
  1123.  
  1124.   /* nsIXPConnectJSObjectHolder getWrappedNativePrototype (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsIClassInfo aClassInfo); */
  1125.   NS_IMETHOD GetWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder **_retval) = 0;
  1126.  
  1127.   /* attribute PRBool collectGarbageOnMainThreadOnly; */
  1128.   NS_IMETHOD GetCollectGarbageOnMainThreadOnly(PRBool *aCollectGarbageOnMainThreadOnly) = 0;
  1129.   NS_IMETHOD SetCollectGarbageOnMainThreadOnly(PRBool aCollectGarbageOnMainThreadOnly) = 0;
  1130.  
  1131.   /* attribute PRBool deferReleasesUntilAfterGarbageCollection; */
  1132.   NS_IMETHOD GetDeferReleasesUntilAfterGarbageCollection(PRBool *aDeferReleasesUntilAfterGarbageCollection) = 0;
  1133.   NS_IMETHOD SetDeferReleasesUntilAfterGarbageCollection(PRBool aDeferReleasesUntilAfterGarbageCollection) = 0;
  1134.  
  1135.   /* void releaseJSContext (in JSContextPtr aJSContext, in PRBool noGC); */
  1136.   NS_IMETHOD ReleaseJSContext(JSContext * aJSContext, PRBool noGC) = 0;
  1137.  
  1138.   /* JSVal variantToJS (in JSContextPtr ctx, in JSObjectPtr scope, in nsIVariant value); */
  1139.   NS_IMETHOD VariantToJS(JSContext * ctx, JSObject * scope, nsIVariant *value, jsval *_retval) = 0;
  1140.  
  1141.   /* nsIVariant JSToVariant (in JSContextPtr ctx, in JSVal value); */
  1142.   NS_IMETHOD JSToVariant(JSContext * ctx, jsval value, nsIVariant **_retval) = 0;
  1143.  
  1144.   /**
  1145.      * Preconfigure XPCNativeWrapper automation so that when a scripted
  1146.      * caller whose filename starts with filenamePrefix accesses a wrapped
  1147.      * native that is not flagged as "system", the wrapped native will be
  1148.      * automatically wrapped with an XPCNativeWrapper.
  1149.      *
  1150.      * @param aFilenamePrefix the UTF-8 filename prefix to match, which
  1151.      *                        should end with a slash (/) character
  1152.      */
  1153.   /* void flagSystemFilenamePrefix (in string aFilenamePrefix); */
  1154.   NS_IMETHOD FlagSystemFilenamePrefix(const char *aFilenamePrefix) = 0;
  1155.  
  1156.   /**
  1157.      * Restore an old prototype for wrapped natives of type
  1158.      * aClassInfo. This should be used only when restoring an old
  1159.      * scope into a state close to where it was prior to
  1160.      * being reinitialized.
  1161.      */
  1162.   /* void restoreWrappedNativePrototype (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsIClassInfo aClassInfo, in nsIXPConnectJSObjectHolder aPrototype); */
  1163.   NS_IMETHOD RestoreWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder *aPrototype) = 0;
  1164.  
  1165. };
  1166.  
  1167. /* Use this macro when declaring classes that implement this interface. */
  1168. #define NS_DECL_NSIXPCONNECT \
  1169.   NS_IMETHOD InitClasses(JSContext * aJSContext, JSObject * aGlobalJSObj); \
  1170.   NS_IMETHOD InitClassesWithNewWrappedGlobal(JSContext * aJSContext, nsISupports *aCOMObj, const nsIID & aIID, PRUint32 aFlags, nsIXPConnectJSObjectHolder **_retval); \
  1171.   NS_IMETHOD WrapNative(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectJSObjectHolder **_retval); \
  1172.   NS_IMETHOD WrapJS(JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result); \
  1173.   NS_IMETHOD GetWrappedNativeOfJSObject(JSContext * aJSContext, JSObject * aJSObj, nsIXPConnectWrappedNative **_retval); \
  1174.   NS_IMETHOD SetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager *aManager, PRUint16 flags); \
  1175.   NS_IMETHOD GetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager **aManager, PRUint16 *flags); \
  1176.   NS_IMETHOD SetDefaultSecurityManager(nsIXPCSecurityManager *aManager, PRUint16 flags); \
  1177.   NS_IMETHOD GetDefaultSecurityManager(nsIXPCSecurityManager **aManager, PRUint16 *flags); \
  1178.   NS_IMETHOD CreateStackFrameLocation(PRUint32 aLanguage, const char *aFilename, const char *aFunctionName, PRInt32 aLineNumber, nsIStackFrame *aCaller, nsIStackFrame **_retval); \
  1179.   NS_IMETHOD SyncJSContexts(void); \
  1180.   NS_IMETHOD GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack); \
  1181.   NS_IMETHOD GetCurrentNativeCallContext(nsIXPCNativeCallContext * *aCurrentNativeCallContext); \
  1182.   NS_IMETHOD GetPendingException(nsIException * *aPendingException); \
  1183.   NS_IMETHOD SetPendingException(nsIException * aPendingException); \
  1184.   NS_IMETHOD DebugDump(PRInt16 depth); \
  1185.   NS_IMETHOD DebugDumpObject(nsISupports *aCOMObj, PRInt16 depth); \
  1186.   NS_IMETHOD DebugDumpJSStack(PRBool showArgs, PRBool showLocals, PRBool showThisProps); \
  1187.   NS_IMETHOD DebugDumpEvalInJSStackFrame(PRUint32 aFrameNumber, const char *aSourceText); \
  1188.   NS_IMETHOD SetSafeJSContextForCurrentThread(JSContext * cx); \
  1189.   NS_IMETHOD WrapJSAggregatedToNative(nsISupports *aOuter, JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result); \
  1190.   NS_IMETHOD GetWrappedNativeOfNativeObject(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectWrappedNative **_retval); \
  1191.   NS_IMETHOD GetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator **_retval); \
  1192.   NS_IMETHOD SetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator *aTranslator, nsIXPCFunctionThisTranslator **_retval); \
  1193.   NS_IMETHOD ReparentWrappedNativeIfFound(JSContext * aJSContext, JSObject * aScope, JSObject * aNewParent, nsISupports *aCOMObj, nsIXPConnectJSObjectHolder **_retval); \
  1194.   NS_IMETHOD ClearAllWrappedNativeSecurityPolicies(void); \
  1195.   NS_IMETHOD GetWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder **_retval); \
  1196.   NS_IMETHOD GetCollectGarbageOnMainThreadOnly(PRBool *aCollectGarbageOnMainThreadOnly); \
  1197.   NS_IMETHOD SetCollectGarbageOnMainThreadOnly(PRBool aCollectGarbageOnMainThreadOnly); \
  1198.   NS_IMETHOD GetDeferReleasesUntilAfterGarbageCollection(PRBool *aDeferReleasesUntilAfterGarbageCollection); \
  1199.   NS_IMETHOD SetDeferReleasesUntilAfterGarbageCollection(PRBool aDeferReleasesUntilAfterGarbageCollection); \
  1200.   NS_IMETHOD ReleaseJSContext(JSContext * aJSContext, PRBool noGC); \
  1201.   NS_IMETHOD VariantToJS(JSContext * ctx, JSObject * scope, nsIVariant *value, jsval *_retval); \
  1202.   NS_IMETHOD JSToVariant(JSContext * ctx, jsval value, nsIVariant **_retval); \
  1203.   NS_IMETHOD FlagSystemFilenamePrefix(const char *aFilenamePrefix); \
  1204.   NS_IMETHOD RestoreWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder *aPrototype); 
  1205.  
  1206. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  1207. #define NS_FORWARD_NSIXPCONNECT(_to) \
  1208.   NS_IMETHOD InitClasses(JSContext * aJSContext, JSObject * aGlobalJSObj) { return _to InitClasses(aJSContext, aGlobalJSObj); } \
  1209.   NS_IMETHOD InitClassesWithNewWrappedGlobal(JSContext * aJSContext, nsISupports *aCOMObj, const nsIID & aIID, PRUint32 aFlags, nsIXPConnectJSObjectHolder **_retval) { return _to InitClassesWithNewWrappedGlobal(aJSContext, aCOMObj, aIID, aFlags, _retval); } \
  1210.   NS_IMETHOD WrapNative(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectJSObjectHolder **_retval) { return _to WrapNative(aJSContext, aScope, aCOMObj, aIID, _retval); } \
  1211.   NS_IMETHOD WrapJS(JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result) { return _to WrapJS(aJSContext, aJSObj, aIID, result); } \
  1212.   NS_IMETHOD GetWrappedNativeOfJSObject(JSContext * aJSContext, JSObject * aJSObj, nsIXPConnectWrappedNative **_retval) { return _to GetWrappedNativeOfJSObject(aJSContext, aJSObj, _retval); } \
  1213.   NS_IMETHOD SetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager *aManager, PRUint16 flags) { return _to SetSecurityManagerForJSContext(aJSContext, aManager, flags); } \
  1214.   NS_IMETHOD GetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager **aManager, PRUint16 *flags) { return _to GetSecurityManagerForJSContext(aJSContext, aManager, flags); } \
  1215.   NS_IMETHOD SetDefaultSecurityManager(nsIXPCSecurityManager *aManager, PRUint16 flags) { return _to SetDefaultSecurityManager(aManager, flags); } \
  1216.   NS_IMETHOD GetDefaultSecurityManager(nsIXPCSecurityManager **aManager, PRUint16 *flags) { return _to GetDefaultSecurityManager(aManager, flags); } \
  1217.   NS_IMETHOD CreateStackFrameLocation(PRUint32 aLanguage, const char *aFilename, const char *aFunctionName, PRInt32 aLineNumber, nsIStackFrame *aCaller, nsIStackFrame **_retval) { return _to CreateStackFrameLocation(aLanguage, aFilename, aFunctionName, aLineNumber, aCaller, _retval); } \
  1218.   NS_IMETHOD SyncJSContexts(void) { return _to SyncJSContexts(); } \
  1219.   NS_IMETHOD GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack) { return _to GetCurrentJSStack(aCurrentJSStack); } \
  1220.   NS_IMETHOD GetCurrentNativeCallContext(nsIXPCNativeCallContext * *aCurrentNativeCallContext) { return _to GetCurrentNativeCallContext(aCurrentNativeCallContext); } \
  1221.   NS_IMETHOD GetPendingException(nsIException * *aPendingException) { return _to GetPendingException(aPendingException); } \
  1222.   NS_IMETHOD SetPendingException(nsIException * aPendingException) { return _to SetPendingException(aPendingException); } \
  1223.   NS_IMETHOD DebugDump(PRInt16 depth) { return _to DebugDump(depth); } \
  1224.   NS_IMETHOD DebugDumpObject(nsISupports *aCOMObj, PRInt16 depth) { return _to DebugDumpObject(aCOMObj, depth); } \
  1225.   NS_IMETHOD DebugDumpJSStack(PRBool showArgs, PRBool showLocals, PRBool showThisProps) { return _to DebugDumpJSStack(showArgs, showLocals, showThisProps); } \
  1226.   NS_IMETHOD DebugDumpEvalInJSStackFrame(PRUint32 aFrameNumber, const char *aSourceText) { return _to DebugDumpEvalInJSStackFrame(aFrameNumber, aSourceText); } \
  1227.   NS_IMETHOD SetSafeJSContextForCurrentThread(JSContext * cx) { return _to SetSafeJSContextForCurrentThread(cx); } \
  1228.   NS_IMETHOD WrapJSAggregatedToNative(nsISupports *aOuter, JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result) { return _to WrapJSAggregatedToNative(aOuter, aJSContext, aJSObj, aIID, result); } \
  1229.   NS_IMETHOD GetWrappedNativeOfNativeObject(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectWrappedNative **_retval) { return _to GetWrappedNativeOfNativeObject(aJSContext, aScope, aCOMObj, aIID, _retval); } \
  1230.   NS_IMETHOD GetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator **_retval) { return _to GetFunctionThisTranslator(aIID, _retval); } \
  1231.   NS_IMETHOD SetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator *aTranslator, nsIXPCFunctionThisTranslator **_retval) { return _to SetFunctionThisTranslator(aIID, aTranslator, _retval); } \
  1232.   NS_IMETHOD ReparentWrappedNativeIfFound(JSContext * aJSContext, JSObject * aScope, JSObject * aNewParent, nsISupports *aCOMObj, nsIXPConnectJSObjectHolder **_retval) { return _to ReparentWrappedNativeIfFound(aJSContext, aScope, aNewParent, aCOMObj, _retval); } \
  1233.   NS_IMETHOD ClearAllWrappedNativeSecurityPolicies(void) { return _to ClearAllWrappedNativeSecurityPolicies(); } \
  1234.   NS_IMETHOD GetWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder **_retval) { return _to GetWrappedNativePrototype(aJSContext, aScope, aClassInfo, _retval); } \
  1235.   NS_IMETHOD GetCollectGarbageOnMainThreadOnly(PRBool *aCollectGarbageOnMainThreadOnly) { return _to GetCollectGarbageOnMainThreadOnly(aCollectGarbageOnMainThreadOnly); } \
  1236.   NS_IMETHOD SetCollectGarbageOnMainThreadOnly(PRBool aCollectGarbageOnMainThreadOnly) { return _to SetCollectGarbageOnMainThreadOnly(aCollectGarbageOnMainThreadOnly); } \
  1237.   NS_IMETHOD GetDeferReleasesUntilAfterGarbageCollection(PRBool *aDeferReleasesUntilAfterGarbageCollection) { return _to GetDeferReleasesUntilAfterGarbageCollection(aDeferReleasesUntilAfterGarbageCollection); } \
  1238.   NS_IMETHOD SetDeferReleasesUntilAfterGarbageCollection(PRBool aDeferReleasesUntilAfterGarbageCollection) { return _to SetDeferReleasesUntilAfterGarbageCollection(aDeferReleasesUntilAfterGarbageCollection); } \
  1239.   NS_IMETHOD ReleaseJSContext(JSContext * aJSContext, PRBool noGC) { return _to ReleaseJSContext(aJSContext, noGC); } \
  1240.   NS_IMETHOD VariantToJS(JSContext * ctx, JSObject * scope, nsIVariant *value, jsval *_retval) { return _to VariantToJS(ctx, scope, value, _retval); } \
  1241.   NS_IMETHOD JSToVariant(JSContext * ctx, jsval value, nsIVariant **_retval) { return _to JSToVariant(ctx, value, _retval); } \
  1242.   NS_IMETHOD FlagSystemFilenamePrefix(const char *aFilenamePrefix) { return _to FlagSystemFilenamePrefix(aFilenamePrefix); } \
  1243.   NS_IMETHOD RestoreWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder *aPrototype) { return _to RestoreWrappedNativePrototype(aJSContext, aScope, aClassInfo, aPrototype); } 
  1244.  
  1245. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  1246. #define NS_FORWARD_SAFE_NSIXPCONNECT(_to) \
  1247.   NS_IMETHOD InitClasses(JSContext * aJSContext, JSObject * aGlobalJSObj) { return !_to ? NS_ERROR_NULL_POINTER : _to->InitClasses(aJSContext, aGlobalJSObj); } \
  1248.   NS_IMETHOD InitClassesWithNewWrappedGlobal(JSContext * aJSContext, nsISupports *aCOMObj, const nsIID & aIID, PRUint32 aFlags, nsIXPConnectJSObjectHolder **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->InitClassesWithNewWrappedGlobal(aJSContext, aCOMObj, aIID, aFlags, _retval); } \
  1249.   NS_IMETHOD WrapNative(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectJSObjectHolder **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->WrapNative(aJSContext, aScope, aCOMObj, aIID, _retval); } \
  1250.   NS_IMETHOD WrapJS(JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->WrapJS(aJSContext, aJSObj, aIID, result); } \
  1251.   NS_IMETHOD GetWrappedNativeOfJSObject(JSContext * aJSContext, JSObject * aJSObj, nsIXPConnectWrappedNative **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWrappedNativeOfJSObject(aJSContext, aJSObj, _retval); } \
  1252.   NS_IMETHOD SetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager *aManager, PRUint16 flags) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetSecurityManagerForJSContext(aJSContext, aManager, flags); } \
  1253.   NS_IMETHOD GetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager **aManager, PRUint16 *flags) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSecurityManagerForJSContext(aJSContext, aManager, flags); } \
  1254.   NS_IMETHOD SetDefaultSecurityManager(nsIXPCSecurityManager *aManager, PRUint16 flags) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDefaultSecurityManager(aManager, flags); } \
  1255.   NS_IMETHOD GetDefaultSecurityManager(nsIXPCSecurityManager **aManager, PRUint16 *flags) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDefaultSecurityManager(aManager, flags); } \
  1256.   NS_IMETHOD CreateStackFrameLocation(PRUint32 aLanguage, const char *aFilename, const char *aFunctionName, PRInt32 aLineNumber, nsIStackFrame *aCaller, nsIStackFrame **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateStackFrameLocation(aLanguage, aFilename, aFunctionName, aLineNumber, aCaller, _retval); } \
  1257.   NS_IMETHOD SyncJSContexts(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->SyncJSContexts(); } \
  1258.   NS_IMETHOD GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCurrentJSStack(aCurrentJSStack); } \
  1259.   NS_IMETHOD GetCurrentNativeCallContext(nsIXPCNativeCallContext * *aCurrentNativeCallContext) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCurrentNativeCallContext(aCurrentNativeCallContext); } \
  1260.   NS_IMETHOD GetPendingException(nsIException * *aPendingException) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPendingException(aPendingException); } \
  1261.   NS_IMETHOD SetPendingException(nsIException * aPendingException) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetPendingException(aPendingException); } \
  1262.   NS_IMETHOD DebugDump(PRInt16 depth) { return !_to ? NS_ERROR_NULL_POINTER : _to->DebugDump(depth); } \
  1263.   NS_IMETHOD DebugDumpObject(nsISupports *aCOMObj, PRInt16 depth) { return !_to ? NS_ERROR_NULL_POINTER : _to->DebugDumpObject(aCOMObj, depth); } \
  1264.   NS_IMETHOD DebugDumpJSStack(PRBool showArgs, PRBool showLocals, PRBool showThisProps) { return !_to ? NS_ERROR_NULL_POINTER : _to->DebugDumpJSStack(showArgs, showLocals, showThisProps); } \
  1265.   NS_IMETHOD DebugDumpEvalInJSStackFrame(PRUint32 aFrameNumber, const char *aSourceText) { return !_to ? NS_ERROR_NULL_POINTER : _to->DebugDumpEvalInJSStackFrame(aFrameNumber, aSourceText); } \
  1266.   NS_IMETHOD SetSafeJSContextForCurrentThread(JSContext * cx) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetSafeJSContextForCurrentThread(cx); } \
  1267.   NS_IMETHOD WrapJSAggregatedToNative(nsISupports *aOuter, JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->WrapJSAggregatedToNative(aOuter, aJSContext, aJSObj, aIID, result); } \
  1268.   NS_IMETHOD GetWrappedNativeOfNativeObject(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectWrappedNative **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWrappedNativeOfNativeObject(aJSContext, aScope, aCOMObj, aIID, _retval); } \
  1269.   NS_IMETHOD GetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFunctionThisTranslator(aIID, _retval); } \
  1270.   NS_IMETHOD SetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator *aTranslator, nsIXPCFunctionThisTranslator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetFunctionThisTranslator(aIID, aTranslator, _retval); } \
  1271.   NS_IMETHOD ReparentWrappedNativeIfFound(JSContext * aJSContext, JSObject * aScope, JSObject * aNewParent, nsISupports *aCOMObj, nsIXPConnectJSObjectHolder **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReparentWrappedNativeIfFound(aJSContext, aScope, aNewParent, aCOMObj, _retval); } \
  1272.   NS_IMETHOD ClearAllWrappedNativeSecurityPolicies(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->ClearAllWrappedNativeSecurityPolicies(); } \
  1273.   NS_IMETHOD GetWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWrappedNativePrototype(aJSContext, aScope, aClassInfo, _retval); } \
  1274.   NS_IMETHOD GetCollectGarbageOnMainThreadOnly(PRBool *aCollectGarbageOnMainThreadOnly) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCollectGarbageOnMainThreadOnly(aCollectGarbageOnMainThreadOnly); } \
  1275.   NS_IMETHOD SetCollectGarbageOnMainThreadOnly(PRBool aCollectGarbageOnMainThreadOnly) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCollectGarbageOnMainThreadOnly(aCollectGarbageOnMainThreadOnly); } \
  1276.   NS_IMETHOD GetDeferReleasesUntilAfterGarbageCollection(PRBool *aDeferReleasesUntilAfterGarbageCollection) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDeferReleasesUntilAfterGarbageCollection(aDeferReleasesUntilAfterGarbageCollection); } \
  1277.   NS_IMETHOD SetDeferReleasesUntilAfterGarbageCollection(PRBool aDeferReleasesUntilAfterGarbageCollection) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDeferReleasesUntilAfterGarbageCollection(aDeferReleasesUntilAfterGarbageCollection); } \
  1278.   NS_IMETHOD ReleaseJSContext(JSContext * aJSContext, PRBool noGC) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReleaseJSContext(aJSContext, noGC); } \
  1279.   NS_IMETHOD VariantToJS(JSContext * ctx, JSObject * scope, nsIVariant *value, jsval *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->VariantToJS(ctx, scope, value, _retval); } \
  1280.   NS_IMETHOD JSToVariant(JSContext * ctx, jsval value, nsIVariant **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->JSToVariant(ctx, value, _retval); } \
  1281.   NS_IMETHOD FlagSystemFilenamePrefix(const char *aFilenamePrefix) { return !_to ? NS_ERROR_NULL_POINTER : _to->FlagSystemFilenamePrefix(aFilenamePrefix); } \
  1282.   NS_IMETHOD RestoreWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder *aPrototype) { return !_to ? NS_ERROR_NULL_POINTER : _to->RestoreWrappedNativePrototype(aJSContext, aScope, aClassInfo, aPrototype); } 
  1283.  
  1284. #if 0
  1285. /* Use the code below as a template for the implementation class for this interface. */
  1286.  
  1287. /* Header file */
  1288. class nsXPConnect : public nsIXPConnect
  1289. {
  1290. public:
  1291.   NS_DECL_ISUPPORTS
  1292.   NS_DECL_NSIXPCONNECT
  1293.  
  1294.   nsXPConnect();
  1295.  
  1296. private:
  1297.   ~nsXPConnect();
  1298.  
  1299. protected:
  1300.   /* additional members */
  1301. };
  1302.  
  1303. /* Implementation file */
  1304. NS_IMPL_ISUPPORTS1(nsXPConnect, nsIXPConnect)
  1305.  
  1306. nsXPConnect::nsXPConnect()
  1307. {
  1308.   /* member initializers and constructor code */
  1309. }
  1310.  
  1311. nsXPConnect::~nsXPConnect()
  1312. {
  1313.   /* destructor code */
  1314. }
  1315.  
  1316. /* void initClasses (in JSContextPtr aJSContext, in JSObjectPtr aGlobalJSObj); */
  1317. NS_IMETHODIMP nsXPConnect::InitClasses(JSContext * aJSContext, JSObject * aGlobalJSObj)
  1318. {
  1319.     return NS_ERROR_NOT_IMPLEMENTED;
  1320. }
  1321.  
  1322. /* nsIXPConnectJSObjectHolder initClassesWithNewWrappedGlobal (in JSContextPtr aJSContext, in nsISupports aCOMObj, in nsIIDRef aIID, in PRUint32 aFlags); */
  1323. NS_IMETHODIMP nsXPConnect::InitClassesWithNewWrappedGlobal(JSContext * aJSContext, nsISupports *aCOMObj, const nsIID & aIID, PRUint32 aFlags, nsIXPConnectJSObjectHolder **_retval)
  1324. {
  1325.     return NS_ERROR_NOT_IMPLEMENTED;
  1326. }
  1327.  
  1328. /* nsIXPConnectJSObjectHolder wrapNative (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDRef aIID); */
  1329. NS_IMETHODIMP nsXPConnect::WrapNative(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectJSObjectHolder **_retval)
  1330. {
  1331.     return NS_ERROR_NOT_IMPLEMENTED;
  1332. }
  1333.  
  1334. /* void wrapJS (in JSContextPtr aJSContext, in JSObjectPtr aJSObj, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
  1335. NS_IMETHODIMP nsXPConnect::WrapJS(JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result)
  1336. {
  1337.     return NS_ERROR_NOT_IMPLEMENTED;
  1338. }
  1339.  
  1340. /* nsIXPConnectWrappedNative getWrappedNativeOfJSObject (in JSContextPtr aJSContext, in JSObjectPtr aJSObj); */
  1341. NS_IMETHODIMP nsXPConnect::GetWrappedNativeOfJSObject(JSContext * aJSContext, JSObject * aJSObj, nsIXPConnectWrappedNative **_retval)
  1342. {
  1343.     return NS_ERROR_NOT_IMPLEMENTED;
  1344. }
  1345.  
  1346. /* void setSecurityManagerForJSContext (in JSContextPtr aJSContext, in nsIXPCSecurityManager aManager, in PRUint16 flags); */
  1347. NS_IMETHODIMP nsXPConnect::SetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager *aManager, PRUint16 flags)
  1348. {
  1349.     return NS_ERROR_NOT_IMPLEMENTED;
  1350. }
  1351.  
  1352. /* void getSecurityManagerForJSContext (in JSContextPtr aJSContext, out nsIXPCSecurityManager aManager, out PRUint16 flags); */
  1353. NS_IMETHODIMP nsXPConnect::GetSecurityManagerForJSContext(JSContext * aJSContext, nsIXPCSecurityManager **aManager, PRUint16 *flags)
  1354. {
  1355.     return NS_ERROR_NOT_IMPLEMENTED;
  1356. }
  1357.  
  1358. /* void setDefaultSecurityManager (in nsIXPCSecurityManager aManager, in PRUint16 flags); */
  1359. NS_IMETHODIMP nsXPConnect::SetDefaultSecurityManager(nsIXPCSecurityManager *aManager, PRUint16 flags)
  1360. {
  1361.     return NS_ERROR_NOT_IMPLEMENTED;
  1362. }
  1363.  
  1364. /* void getDefaultSecurityManager (out nsIXPCSecurityManager aManager, out PRUint16 flags); */
  1365. NS_IMETHODIMP nsXPConnect::GetDefaultSecurityManager(nsIXPCSecurityManager **aManager, PRUint16 *flags)
  1366. {
  1367.     return NS_ERROR_NOT_IMPLEMENTED;
  1368. }
  1369.  
  1370. /* nsIStackFrame createStackFrameLocation (in PRUint32 aLanguage, in string aFilename, in string aFunctionName, in PRInt32 aLineNumber, in nsIStackFrame aCaller); */
  1371. NS_IMETHODIMP nsXPConnect::CreateStackFrameLocation(PRUint32 aLanguage, const char *aFilename, const char *aFunctionName, PRInt32 aLineNumber, nsIStackFrame *aCaller, nsIStackFrame **_retval)
  1372. {
  1373.     return NS_ERROR_NOT_IMPLEMENTED;
  1374. }
  1375.  
  1376. /* void syncJSContexts (); */
  1377. NS_IMETHODIMP nsXPConnect::SyncJSContexts()
  1378. {
  1379.     return NS_ERROR_NOT_IMPLEMENTED;
  1380. }
  1381.  
  1382. /* readonly attribute nsIStackFrame CurrentJSStack; */
  1383. NS_IMETHODIMP nsXPConnect::GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack)
  1384. {
  1385.     return NS_ERROR_NOT_IMPLEMENTED;
  1386. }
  1387.  
  1388. /* readonly attribute nsIXPCNativeCallContext CurrentNativeCallContext; */
  1389. NS_IMETHODIMP nsXPConnect::GetCurrentNativeCallContext(nsIXPCNativeCallContext * *aCurrentNativeCallContext)
  1390. {
  1391.     return NS_ERROR_NOT_IMPLEMENTED;
  1392. }
  1393.  
  1394. /* attribute nsIException PendingException; */
  1395. NS_IMETHODIMP nsXPConnect::GetPendingException(nsIException * *aPendingException)
  1396. {
  1397.     return NS_ERROR_NOT_IMPLEMENTED;
  1398. }
  1399. NS_IMETHODIMP nsXPConnect::SetPendingException(nsIException * aPendingException)
  1400. {
  1401.     return NS_ERROR_NOT_IMPLEMENTED;
  1402. }
  1403.  
  1404. /* void debugDump (in short depth); */
  1405. NS_IMETHODIMP nsXPConnect::DebugDump(PRInt16 depth)
  1406. {
  1407.     return NS_ERROR_NOT_IMPLEMENTED;
  1408. }
  1409.  
  1410. /* void debugDumpObject (in nsISupports aCOMObj, in short depth); */
  1411. NS_IMETHODIMP nsXPConnect::DebugDumpObject(nsISupports *aCOMObj, PRInt16 depth)
  1412. {
  1413.     return NS_ERROR_NOT_IMPLEMENTED;
  1414. }
  1415.  
  1416. /* void debugDumpJSStack (in PRBool showArgs, in PRBool showLocals, in PRBool showThisProps); */
  1417. NS_IMETHODIMP nsXPConnect::DebugDumpJSStack(PRBool showArgs, PRBool showLocals, PRBool showThisProps)
  1418. {
  1419.     return NS_ERROR_NOT_IMPLEMENTED;
  1420. }
  1421.  
  1422. /* void debugDumpEvalInJSStackFrame (in PRUint32 aFrameNumber, in string aSourceText); */
  1423. NS_IMETHODIMP nsXPConnect::DebugDumpEvalInJSStackFrame(PRUint32 aFrameNumber, const char *aSourceText)
  1424. {
  1425.     return NS_ERROR_NOT_IMPLEMENTED;
  1426. }
  1427.  
  1428. /* void setSafeJSContextForCurrentThread (in JSContextPtr cx); */
  1429. NS_IMETHODIMP nsXPConnect::SetSafeJSContextForCurrentThread(JSContext * cx)
  1430. {
  1431.     return NS_ERROR_NOT_IMPLEMENTED;
  1432. }
  1433.  
  1434. /* void wrapJSAggregatedToNative (in nsISupports aOuter, in JSContextPtr aJSContext, in JSObjectPtr aJSObj, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
  1435. NS_IMETHODIMP nsXPConnect::WrapJSAggregatedToNative(nsISupports *aOuter, JSContext * aJSContext, JSObject * aJSObj, const nsIID & aIID, void * *result)
  1436. {
  1437.     return NS_ERROR_NOT_IMPLEMENTED;
  1438. }
  1439.  
  1440. /* nsIXPConnectWrappedNative getWrappedNativeOfNativeObject (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDRef aIID); */
  1441. NS_IMETHODIMP nsXPConnect::GetWrappedNativeOfNativeObject(JSContext * aJSContext, JSObject * aScope, nsISupports *aCOMObj, const nsIID & aIID, nsIXPConnectWrappedNative **_retval)
  1442. {
  1443.     return NS_ERROR_NOT_IMPLEMENTED;
  1444. }
  1445.  
  1446. /* nsIXPCFunctionThisTranslator getFunctionThisTranslator (in nsIIDRef aIID); */
  1447. NS_IMETHODIMP nsXPConnect::GetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator **_retval)
  1448. {
  1449.     return NS_ERROR_NOT_IMPLEMENTED;
  1450. }
  1451.  
  1452. /* nsIXPCFunctionThisTranslator setFunctionThisTranslator (in nsIIDRef aIID, in nsIXPCFunctionThisTranslator aTranslator); */
  1453. NS_IMETHODIMP nsXPConnect::SetFunctionThisTranslator(const nsIID & aIID, nsIXPCFunctionThisTranslator *aTranslator, nsIXPCFunctionThisTranslator **_retval)
  1454. {
  1455.     return NS_ERROR_NOT_IMPLEMENTED;
  1456. }
  1457.  
  1458. /* nsIXPConnectJSObjectHolder reparentWrappedNativeIfFound (in JSContextPtr aJSContext, in JSObjectPtr aScope, in JSObjectPtr aNewParent, in nsISupports aCOMObj); */
  1459. NS_IMETHODIMP nsXPConnect::ReparentWrappedNativeIfFound(JSContext * aJSContext, JSObject * aScope, JSObject * aNewParent, nsISupports *aCOMObj, nsIXPConnectJSObjectHolder **_retval)
  1460. {
  1461.     return NS_ERROR_NOT_IMPLEMENTED;
  1462. }
  1463.  
  1464. /* void clearAllWrappedNativeSecurityPolicies (); */
  1465. NS_IMETHODIMP nsXPConnect::ClearAllWrappedNativeSecurityPolicies()
  1466. {
  1467.     return NS_ERROR_NOT_IMPLEMENTED;
  1468. }
  1469.  
  1470. /* nsIXPConnectJSObjectHolder getWrappedNativePrototype (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsIClassInfo aClassInfo); */
  1471. NS_IMETHODIMP nsXPConnect::GetWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder **_retval)
  1472. {
  1473.     return NS_ERROR_NOT_IMPLEMENTED;
  1474. }
  1475.  
  1476. /* attribute PRBool collectGarbageOnMainThreadOnly; */
  1477. NS_IMETHODIMP nsXPConnect::GetCollectGarbageOnMainThreadOnly(PRBool *aCollectGarbageOnMainThreadOnly)
  1478. {
  1479.     return NS_ERROR_NOT_IMPLEMENTED;
  1480. }
  1481. NS_IMETHODIMP nsXPConnect::SetCollectGarbageOnMainThreadOnly(PRBool aCollectGarbageOnMainThreadOnly)
  1482. {
  1483.     return NS_ERROR_NOT_IMPLEMENTED;
  1484. }
  1485.  
  1486. /* attribute PRBool deferReleasesUntilAfterGarbageCollection; */
  1487. NS_IMETHODIMP nsXPConnect::GetDeferReleasesUntilAfterGarbageCollection(PRBool *aDeferReleasesUntilAfterGarbageCollection)
  1488. {
  1489.     return NS_ERROR_NOT_IMPLEMENTED;
  1490. }
  1491. NS_IMETHODIMP nsXPConnect::SetDeferReleasesUntilAfterGarbageCollection(PRBool aDeferReleasesUntilAfterGarbageCollection)
  1492. {
  1493.     return NS_ERROR_NOT_IMPLEMENTED;
  1494. }
  1495.  
  1496. /* void releaseJSContext (in JSContextPtr aJSContext, in PRBool noGC); */
  1497. NS_IMETHODIMP nsXPConnect::ReleaseJSContext(JSContext * aJSContext, PRBool noGC)
  1498. {
  1499.     return NS_ERROR_NOT_IMPLEMENTED;
  1500. }
  1501.  
  1502. /* JSVal variantToJS (in JSContextPtr ctx, in JSObjectPtr scope, in nsIVariant value); */
  1503. NS_IMETHODIMP nsXPConnect::VariantToJS(JSContext * ctx, JSObject * scope, nsIVariant *value, jsval *_retval)
  1504. {
  1505.     return NS_ERROR_NOT_IMPLEMENTED;
  1506. }
  1507.  
  1508. /* nsIVariant JSToVariant (in JSContextPtr ctx, in JSVal value); */
  1509. NS_IMETHODIMP nsXPConnect::JSToVariant(JSContext * ctx, jsval value, nsIVariant **_retval)
  1510. {
  1511.     return NS_ERROR_NOT_IMPLEMENTED;
  1512. }
  1513.  
  1514. /* void flagSystemFilenamePrefix (in string aFilenamePrefix); */
  1515. NS_IMETHODIMP nsXPConnect::FlagSystemFilenamePrefix(const char *aFilenamePrefix)
  1516. {
  1517.     return NS_ERROR_NOT_IMPLEMENTED;
  1518. }
  1519.  
  1520. /* void restoreWrappedNativePrototype (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsIClassInfo aClassInfo, in nsIXPConnectJSObjectHolder aPrototype); */
  1521. NS_IMETHODIMP nsXPConnect::RestoreWrappedNativePrototype(JSContext * aJSContext, JSObject * aScope, nsIClassInfo *aClassInfo, nsIXPConnectJSObjectHolder *aPrototype)
  1522. {
  1523.     return NS_ERROR_NOT_IMPLEMENTED;
  1524. }
  1525.  
  1526. /* End of implementation class template. */
  1527. #endif
  1528.  
  1529.  
  1530. #endif /* __gen_nsIXPConnect_h__ */
  1531.